[codex] Revoke credentials when role permissions change#2262
Merged
benjaminshafii merged 1 commit intoJun 14, 2026
Conversation
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
1 issue found across 3 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="ee/apps/den-api/src/routes/org/roles.ts">
<violation number="1" location="ee/apps/den-api/src/routes/org/roles.ts:221">
P1: Credential revocation is non-atomic with the role permission update, so revocation failures can leave stale credentials after a successful permission change. This is a fail-open security gap in the new hardening path.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
| } | ||
|
|
||
| if (permissionChanged) { | ||
| await revokeCredentialsForOrganizationRoleMembers({ |
There was a problem hiding this comment.
P1: Credential revocation is non-atomic with the role permission update, so revocation failures can leave stale credentials after a successful permission change. This is a fail-open security gap in the new hardening path.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At ee/apps/den-api/src/routes/org/roles.ts, line 221:
<comment>Credential revocation is non-atomic with the role permission update, so revocation failures can leave stale credentials after a successful permission change. This is a fail-open security gap in the new hardening path.</comment>
<file context>
@@ -215,6 +217,13 @@ export function registerOrgRoleRoutes<T extends { Variables: OrgRouteVariables }
}
+ if (permissionChanged) {
+ await revokeCredentialsForOrganizationRoleMembers({
+ organizationId: payload.organization.id,
+ role: nextRoleName,
</file context>
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.
Summary
Why
Changing a custom role permission map can grant or remove sensitive delegated security capabilities for every current member with that role. Direct member role changes already revoke credentials; role permission-map changes now get the same treatment.
Validation
pnpm install --frozen-lockfilepassed.pnpm --filter @openwork-ee/den-db buildpassed.pnpm --filter @openwork-ee/utils buildpassed.pnpm --filter @openwork-ee/den-api buildpassed.pnpm --dir ee/apps/den-api exec tsc -p tsconfig.json --noEmitpassed.bun test ee/apps/den-api/test/organization-role-credential-revocation.test.ts ee/apps/den-api/test/org-role-permissions.test.ts ee/apps/den-api/test/org-identity-access.test.tspassed, 13 pass / 0 fail.bun test ee/apps/den-api/testpassed, 144 pass / 0 fail.git diff --checkpassed.git diff --cached --checkpassed before commit.Daytona Evidence
.devcontainer/test-server-on-daytona.shfor this server-only validation.openwork-security-role-revoke-20260613-202528checked out commitc1429c3.GET /healthreturned{"ok":true,"service":"den-api"}.GET /api/den/healthreturned{"ok":true,"service":"den-api"}.worker_not_found, as expected.Live Smoke
Video is not relevant for this server-only authorization/credential lifecycle hardening; the focused Daytona server smoke and tests are the relevant runtime evidence.
Merge Note
Draft PR only. Do not merge until reviewed.