René's URL Explorer Experiment


Title: bug: token allow-list with a specific template ID returns 500 "column reference \"id\" is ambiguous" · Issue #32059 · coder/coder · GitHub

Open Graph Title: bug: token allow-list with a specific template ID returns 500 "column reference \"id\" is ambiguous" · Issue #32059 · coder/coder

X Title: bug: token allow-list with a specific template ID returns 500 "column reference \"id\" is ambiguous" · Issue #32059 · coder/coder

Description: Is there an existing issue for this? I have searched the existing issues Current Behavior When testing API-token allow-lists, a token whose allow-list names a specific template (template:) gets an HTTP 500 from any request...

Open Graph Description: Is there an existing issue for this? I have searched the existing issues Current Behavior When testing API-token allow-lists, a token whose allow-list names a specific template (template:

X Description: Is there an existing issue for this? I have searched the existing issues Current Behavior When testing API-token allow-lists, a token whose allow-list names a specific template (template:<templa...

Opengraph URL: https://github.com/coder/coder/issues/32059

X: @github

direct link

Domain: github.com

IPv4 address: 140.82.112.3


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"bug: token allow-list with a specific template ID returns 500 \"column reference \\\"id\\\" is ambiguous\"","articleBody":"### Is there an existing issue for this?\n\n- [x] I have searched the existing issues\n\n### Current Behavior\n\nWhen testing API-token allow-lists, a token whose allow-list names a specific template (`template:\u003ctemplate-uuid>`) gets an HTTP 500 from any request that runs the authorized templates query. Workspace creation with the same token succeeds. Reading the workspace back afterwards fails, because building the workspace response loads templates through `GetAuthorizedTemplates`.\n\nThe same token with `template:*` instead works.\n\n### Relevant Log Output\n\n```shell\nGET /api/v2/workspaces/\u003cworkspace-id>\n500 {\"message\":\"Internal error fetching workspace resources.\",\"detail\":\"get templates: pq: column reference \\\"id\\\" is ambiguous\"}\n```\n\n### Expected Behavior\n\nRequests for templates named in the token's allow-list are authorized normally (here, `GET /api/v2/workspaces/\u003cworkspace-id>` returns 200), and templates outside the allow-list are filtered out.\n\n### Steps to Reproduce\n\n1. As an admin, create a regular user `\u003cuser>` with the default Member role in the default organization.\n2. Create a scoped token for that user with a template-specific allow-list:\n   ```\n   coder tokens create --user \u003cuser> --lifetime 1d \\\n     --scope coder:workspaces.create --scope coder:workspaces.access \\\n     --allow template:\u003ctemplate-uuid> \\\n     --allow workspace:* \\\n     --allow organization_member:\u003cuser-uuid>\n   ```\n3. With that token, `POST /api/v2/users/\u003cuser>/workspaces` using a version of `\u003ctemplate-uuid>`. This returns 201.\n4. With that token, `GET /api/v2/workspaces/\u003cworkspace-id>`. This returns the 500 above.\n5. Repeat with `--allow template:*` instead of `--allow template:\u003ctemplate-uuid>`. Step 4 then returns 200.\n\n### Root cause\n\n`TemplateConverter()` in `coderd/rbac/regosql/configs.go` registers `resourceIDMatcher()`, which emits an unqualified column:\n\n```go\nfunc resourceIDMatcher() sqltypes.VariableMatcher {\n\treturn sqltypes.StringVarMatcher(\"id :: text\", []string{\"input\", \"object\", \"id\"})\n}\n```\n\n`GetAuthorizedTemplates` in `coderd/database/modelqueries.go` appends the compiled filter to `GetTemplatesWithFilter`, which joins a second table that also has an `id` column:\n\n```sql\nSELECT t.*\nFROM template_with_names AS t\nLEFT JOIN template_versions tv ON t.active_version_id = tv.id\nWHERE ...\n```\n\nThe ID predicate is only emitted when the allow-list names a specific template ID. That is why wildcard allow-lists, and tokens without allow-lists, are not affected. The same converter already qualifies the organization column (`t.organization_id :: text`), so the likely fix is a template-qualified ID matcher in `TemplateConverter`, such as `t.id :: text`. A regression test that compiles a non-wildcard template allow-list against this query would cover it.\n\n### Workaround\n\nUse `--allow template:*`. The token can then read and use any template the user's role can already access, so pinning to one template has to be enforced by the client.\n\n### Environment\n\n- Host OS: macOS (arm64), Coder server with built-in PostgreSQL\n- Coder version: v2.38.7. The same code is present in v2.39.1 and on `main` at 1126533c3169aaea7b44824363375edbf480a742 (`resourceIDMatcher` and `TemplateConverter` in `coderd/rbac/regosql/configs.go`, `GetTemplatesWithFilter` in `coderd/database/queries/templates.sql`).\n\n### Additional Context\n\nThe issue occurs consistently. Possibly related to the broader compiled-SQL audit in #25982, but this is a specific query failure rather than an ACL semantics difference.\n","author":{"url":"https://github.com/factory-brandon-callender","@type":"Person","name":"factory-brandon-callender"},"datePublished":"2026-11-11T16:49:01Z","url":"https://github.com/coder/coder/issues/32059"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:962947f9-9538-5b68-e3e6-35c02be2bed3
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idD316:291B58:9D33570:C8EA953:6B042D96
html-safe-nonce222d3648d36f48497dced5e2381d94c3f4de3170858c93fd7d6556c535dfc1f4
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEMzE2OjI5MUI1ODo5RDMzNTcwOkM4RUE5NTM6NkIwNDJEOTYiLCJ2aXNpdG9yX2lkIjoiMTk3MjQ0NzQ1NDU1NzM4NDA4NiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac49f694263541e6e461f56620b115b13f86cd5a52fd445a09bb752dd09b3c621c
hovercard-subject-tagissue:6333065993
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/coder/coder/32059/issue_layout
twitter:imagehttps://opengraph.githubassets.com/cc572e67dce7018702dc428f531cb9728e5d6686ee3e58588208c9fc8f4fc606/coder/coder/issues/32059
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/cc572e67dce7018702dc428f531cb9728e5d6686ee3e58588208c9fc8f4fc606/coder/coder/issues/32059
og:image:altIs there an existing issue for this? I have searched the existing issues Current Behavior When testing API-token allow-lists, a token whose allow-list names a specific template (template:
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamefactory-brandon-callender
hostnamegithub.com
expected-hostnamegithub.com
Noneb7a1d2b9101496921b08579fbee988d014345aef2f5bd660d1f8c7332d81560e
turbo-cache-controlno-preview
go-importgithub.com/coder/coder git https://github.com/coder/coder.git
octolytics-dimension-user_id95932066
octolytics-dimension-user_logincoder
octolytics-dimension-repository_id440752086
octolytics-dimension-repository_nwocoder/coder
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id440752086
octolytics-dimension-repository_network_root_nwocoder/coder
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releasec3dd496c3da6ea6b77e69c09279d2b81604654f1
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/coder/coder/issues/32059#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fcoder%2Fcoder%2Fissues%2F32059
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fcoder%2Fcoder%2Fissues%2F32059
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=coder%2Fcoder
Reloadhttps://github.com/coder/coder/issues/32059
Reloadhttps://github.com/coder/coder/issues/32059
Reloadhttps://github.com/coder/coder/issues/32059
coderhttps://github.com/coder
coderhttps://github.com/coder/coder
Codehttps://github.com/coder/coder
Issues322 (322)https://github.com/coder/coder/issues
Pull requests472 (472)https://github.com/coder/coder/pulls
Discussionshttps://github.com/coder/coder/discussions
Actionshttps://github.com/coder/coder/actions
Projectshttps://github.com/coder/coder/projects
Security and quality49 (49)https://github.com/coder/coder/security
Insightshttps://github.com/coder/coder/insights
https://github.com/coder/coder
New issuehttps://github.com/login?return_to=https://github.com/coder/coder/issues/32059
New issuehttps://github.com/login?return_to=https://github.com/coder/coder/issues/32059
#32103https://github.com/coder/coder/pull/32103
bug: token allow-list with a specific template ID returns 500 "column reference \"id\" is ambiguous"https://github.com/coder/coder/issues/32059#top
#32103https://github.com/coder/coder/pull/32103
https://github.com/factory-brandon-callender
factory-brandon-callenderhttps://github.com/factory-brandon-callender
on Nov 11, 2026https://github.com/coder/coder/issues/32059#issue-6333065993
1126533https://github.com/coder/coder/commit/1126533c3169aaea7b44824363375edbf480a742
#25982https://github.com/coder/coder/issues/25982
https://github.com/apps/linear-code
linear-codehttps://github.com/apps/linear-code
on Nov 11, 2026https://github.com/coder/coder/issues/32059#issuecomment-6801783573
Linear Codehttps://linear.app
ENG-3532https://linear.app/codercom/issue/ENG-3532
https://github.com/simonepri
simoneprihttps://github.com/simonepri
on Nov 13, 2026https://github.com/coder/coder/issues/32059#issuecomment-6859082597
Sign up for freehttps://github.com/signup?return_to=https://github.com/coder/coder/issues/32059
Sign in to commenthttps://github.com/login?return_to=https://github.com/coder/coder/issues/32059
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Response headers:
Servergithub.com
Content-Typetext/html; charset=utf-8
Cache-Controlmax-age=0, private, must-revalidate

Viewport: width=device-width


URLs of crawlers that visited me.