Repository navigation
feat(delegation): revoking someone stops only them unless the revocation cascades - #1197
Conversation
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configuration
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 70416c5dcc
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6921f2033d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4f63c87008
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const cascade = | ||
| parent.meta?.cascade ?? | ||
| (flag !== undefined && flag !== null && flag !== false); | ||
| if (cascade) return false; |
There was a problem hiding this comment.
Preserve limits from before a non-cascading revocation
When a non-cascading revocation is stored as a complete record that omits or loosens the optional appLimits, stillBacks keeps earlier children valid but the evaluator later uses only the revoked record's final limits. Those children therefore receive a less restrictive appLimits list and a platform may authorize operations above the limit that applied when they were granted. Preserve the last active limits for surviving grants, or reject revocation versions that loosen them.
Useful? React with 👍 / 👎.
| return fail("REVOKED", current.roleId, "role revoked"); | ||
| } | ||
| narrow(role.scopes); | ||
| if (current.mayRedelegate && !role.mayRedelegate) { |
There was a problem hiding this comment.
Exempt revoked roles from the current redelegation check
When a role is revoked without cascade and that revocation also sets mayRedelegate: false, every previously granted holder whose delegation still has mayRedelegate: true fails here with REDELEGATION_NOT_ALLOWED. This makes the role revocation cascade despite stillBacks accepting it; the parent-delegation branch already avoids the same problem for revoked parents. Judge this flag from the role state when the holder was granted, or skip the current-state check for a revoked role that still backs the grant.
Useful? React with 👍 / 👎.
…, cap grants at what their source held then
…il closed on malformed cascade flags and past odd statuses
4f63c87 to
4ce65be
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4ce65bec97
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const problem = linkProblem( | ||
| current, | ||
| leaf.companyEName, | ||
| now, | ||
| current !== leaf, |
There was a problem hiding this comment.
Preserve the validity window before non-cascading revocation
When a non-cascading revocation changes an ancestor's validFrom or validUntil, this call still runs windowProblem against the revoked version, so an earlier valid child can fail with EXPIRED or NOT_YET_VALID even though revocationCascade is false. These fields are mutable and history accepts complete revocation versions containing changed values; preserve the last active window for surviving grants or skip the revoked ancestor's current window check.
Useful? React with 👍 / 👎.
| cascade: | ||
| revokedAt !== undefined && | ||
| state.revocationCascade !== undefined && | ||
| state.revocationCascade !== null && | ||
| state.revocationCascade !== false, |
There was a problem hiding this comment.
Honor legacy cascade revocations
When an existing delegation was revoked with revocationReason: "cascade" before revocationCascade existed, this calculation records cascade: false, so descendants that the old explicit cascade revoked become authorized again. The delegation schema still permits and describes revocationReason: "cascade", making this state reachable even for newly validated records; treat that legacy reason as cascading or migrate those records before changing the default.
Useful? React with 👍 / 👎.
Description of change
Firing someone no longer takes down everything they handed on.
revocationCascade: true(new field on Role and Delegation, only allowed on revoked records) revokes everything handed on from it.NOT_A_SUBSETfailure.packages/delegation: history resolution attachesmeta { grantedAt, revokedAt, cascade }from storage times;evaluateDelegationlets a revoked link back what it granted before, unless the revocation cascades; entitlement checks that the grantor's authority was live when each version was stored.Issue Number
Type of change
How the change has been tested
packages/delegation67/67, including new cases: fired grantor keeps earlier grants; cascade drops everything below; grants and revocations signed after firing ignored; re-delegation below a fired parent; role revoked with and without cascade; narrowing shrinks the child.packages/auth97/97 against the rebuilt package. Ontology schemas validated with Ajv (cascade only on revoked records). Full demo replay againstpnpm dev:core: all seven acts end as expected (Act 10: Bob refused, Tim valid; Act 11: Tim refused at Dave); every slide screenshotted.Change checklist