Repository navigation
Auth0: roles from RBAC permissions on a CodeRunner API - #33
Merged
Merged
Conversation
Request an access token for AUTH0_AUDIENCE and map its `permissions` claim (AUTH0_USER_PERMISSION / AUTH0_ADMIN_PERMISSION, defaults coderunner:user / coderunner:admin) to the CodeRunner role, instead of a tenant-wide roles claim in the ID token. Permissions are scoped to the one API, so another app's roles in the same tenant no longer leak in. Auth0 now needs AUTH0_AUDIENCE to be enabled; AUTH0_ROLES_CLAIM and the role-name vars are removed. GCE gets a coderunner-auth0-audience secret. Decision 048. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ubuntu-latest now resolves to Ubuntu 26.04, and Playwright 1.60 refuses
to install Chromium there ("does not support chromium on
ubuntu26.04-x64"), failing CI and release before tests run. 1.65 knows
the platform.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #32.
What
Auth0 sign-ins now get their CodeRunner role from RBAC permissions in an access token for a CodeRunner API, instead of a custom roles claim in the ID token. An ID-token roles claim carries the user's tenant-wide roles, so an
adminrole meant for another app in the same tenant would also make that user a CodeRunner admin. Permissions are scoped to one API (audience), which keeps each app's access separate.audience=AUTH0_AUDIENCE. A customgetUserInforeads identity andemail_verifiedfrom the ID token andpermissionsfrom the access token. Apermissionsclaim in the ID token is ignored.AUTH0_USER_PERMISSION/AUTH0_ADMIN_PERMISSIONdefault tocoderunner:user/coderunner:admin.AUTH0_AUDIENCEis set along with the domain and client credentials. If those three are set without an audience, the server logs a warning and hides the button.CODERUNNER_ADMIN_EMAILoverride (verified emails only), denying users inmapProfileToUserbefore any account is created, and re-reading access at every sign-in.Breaking config change
AUTH0_ROLES_CLAIM,AUTH0_USER_ROLE_NAME, andAUTH0_ADMIN_ROLE_NAMEare removed. To migrate, the tenant needs:AUTH0_AUDIENCE).The old Post-Login Action can then be deleted. On Google Cloud, there's a new
coderunner-auth0-audiencesecret: re-apply Terraform to update the VM's startup script, then add the secret.Setup steps:
docs/deploying/oauth-credentials.md#set-up-auth0. Decision log:docs/decisions/048-auth0-rbac-permissions.md.Testing
auth0.test.ts: the stubbed Auth0 issues a JWT access token withpermissions. The full sign-in tests now run against it. New tests check that the sign-in request includes the audience, and that sign-in is denied for ID-token-only permissions, unrelated permissions, and an opaque (no-audience) access token.auth.test.ts: the Auth0 button is hidden when there's no audience.bun run typecheckandbun run checkpass.bun run testandbun run e2e(80 tests) pass when run against the bundled lesson catalog.Also: Playwright 1.65
ubuntu-latestnow resolves to Ubuntu 26.04, and Playwright 1.60 refuses to install Chromium there, so CI was failing onmainbefore any tests ran. Playwright 1.65 supports Ubuntu 26.04.🤖 Generated with Claude Code