Skip to content

Apply review findings to the Scoped Authorization Grant - #50

Closed
pepebndc wants to merge 13 commits into
feat/scoped-authorization-grantfrom
scoped-grant-review-fixes
Closed

pepebndc wants to merge 13 commits into
feat/scoped-authorization-grantfrom
scoped-grant-review-fixes

Conversation

@pepebndc

Copy link
Copy Markdown
Collaborator

Summary

This PR applies the findings of an independent two-model review (Claude and Codex) of #48 at a49fd3f. It targets feat/scoped-authorization-grant, so it can merge into #48 as one unit. Each finding is one commit.

The review found no critical, high, or medium defect. No commit changes the grant template or the guard logic. Two commits change doc comments in OpenZeppelin.ScopedAuthorizationGrantV1 (99bc9b0, 352c07b). The rest change documentation, one script comment, and tests.

Changes

Finding Severity Commit Change
1 Low 99bc9b0 The README and the field docs state that the validity bounds apply to ledger time, and that a use can commit up to the synchronizer's tolerance outside the window in record time.
2 Info c5fd492 The package README and the root README state the supported runtime (Canton 3.5) and the SDK 3.5 dependency.
3 Low 5da1fb0 The README states that a non-grantee actor gets a native fetch error when no consumer signatory is a grant stakeholder.
4 Low 352c07b The README and the AuthorizationScope doc require epochs to increase and never be reused, and describe future-epoch grants.
5 Info 5db8098 The README states that the guard compares values and that controller authorization.actor is required.
6 Info 024ec09 The README documents the check order, and a test fixes it.
7 Info 93e305f The README states that the error ID strings are the stable contract.
9 Info 60dd149 The treasury README states the confirmation and visibility cost of separate role authorities.
10 Info 463b7f1 The treasury README states that each stage checks only its own role.
11 Info fd0f6c9 The test README states that OZ_LEDGER_PORT does not isolate parallel sandbox runs.
12 Info db0694c AGENTS.md lists the example and sandbox commands. The check-sandbox.sh comment names the suites that check time. The README marks external signing as untested.
Tests 45d8782 Library: failures that a consumer try/catch cannot catch, the native error for a non-grantee actor, microsecond window edges, epoch reuse and future epochs, a consumer signatory that supplies the grantee's authority, and cached disclosures after Revoke and Renounce.
Tests 6091989 Examples: pending treasury stages after a role revocation, a wrong permission under the correct authority, grant windows at proposal, and operator revocation in licensing.

Finding 8 (strict evaluation of the failure statuses) is not applied, because it changes production code for a small cost only.

Verification

dpm build --all
scripts/check.sh
scripts/check-lint.sh
scripts/check-coverage.sh
DAML_PACKAGE=test/scoped-authorization-grant-v1-test dpm test --all --show-coverage
DAML_PACKAGE=examples/licensing-app-v1-test dpm test --all --show-coverage
DAML_PACKAGE=examples/treasury-rbac-v1-test dpm test --all --show-coverage

All pass locally on SDK 3.5.8. I did not run the sandbox suites.

Caveats

  • ScopedAuthorizationGrantV1EdgeTest.daml uses try/catch to show that a consumer cannot catch a guard failure. The build reports deprecation warnings for that module. A module pragma does not turn them off.
  • These review tests are not added: sandbox time tests, Ledger API tests of ErrorInfo, external signing, different ledger and record times, multi-participant tests, an upgrade-check dry run, a Canton 3.4 runtime run, authority rotation in a consumer fixture, and a caught exception after a successful guard. Each needs a setup that Daml Script on the in-memory ledger does not provide, or a larger fixture.

🤖 Generated with Claude Code

pepebndc and others added 13 commits September 23, 2026 12:54
The synchronizer accepts a ledger time within its tolerance of the record
time, so a use can commit up to the tolerance outside the window in record
time. The README and the field docs state this, recommend a margin or
revocation for an exact cutoff, and name the native error for a delayed
submission.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The guard fetches the grant before its checks, so the grantee check runs
only when a consumer signatory or controller is a grant stakeholder.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…troller

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…y role authorities

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
AGENTS.md lists the example lint and test commands and the sandbox
suites. The check-sandbox.sh comment names the suites that check
validity bounds, and the README marks external signing as untested.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
New tests cover failures that a consumer try/catch cannot catch, the
native fetch error for a non-grantee actor, microsecond window edges,
epoch reuse and future epochs, a consumer signatory that supplies the
grantee's authority, and cached disclosures after Revoke and Renounce.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…or revocation

The treasury tests show that a revoked proposer or approver grant does
not stop a pending approval or execution, that a grant with the correct
authority and the wrong permission fails with a scope mismatch, and that
a role grant outside its window fails at the proposal. The licensing
test shows that revoking the operator keeps the issued licenses.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ericnordelo

Copy link
Copy Markdown
Member

Thanks for creating @pepebndc. I applied the fixes manually on the main branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants