Skip to content

docs: align delegation framing with non-strict subset behavior#42

Merged
devonartis merged 3 commits intodevelopfrom
fix/delegation-narrowing-docs
Apr 15, 2026
Merged

docs: align delegation framing with non-strict subset behavior#42
devonartis merged 3 commits intodevelopfrom
fix/delegation-narrowing-docs

Conversation

@devonartis
Copy link
Copy Markdown
Owner

Closes #41

Summary

  • Comments and docs in 9 places claimed delegation enforces strict narrowing ("strict subset", "only narrow", "narrower-scoped"). The actual authz.ScopeIsSubset is a non-strict containment check — equal scopes pass. Same-scope delegation is a deliberate pattern (e.g., fan-out to workers carrying the parent's full authority) and is verified by the SDK acceptance suite (Story 8: "Delegate All Scope (No Narrowing)").
  • Wording template applied across all 12 edits: "cannot widen; equal or narrower is accepted." Source-file docstrings get a longer rationale + back-reference to docs: delegation comments claim "strict subset" / "only narrow" but code is non-strict #41 per golang.md's rule on commenting non-obvious design choices.
  • Verified docs/api.md:1057 ("same or narrower, never wider") and ErrScopeViolation — both already correct, no change needed.

Files changed (12 edits, 9 files)

Source code (3 edits, 2 files) — security-relevant, the original target of #41:

README (2 edits) — front door of the repo:

  • README.md:39 — IAM-comparison table row
  • README.md:43 — IAM-comparison table row

Docs (6 edits, 5 files) — every place inheriting the same wrong framing:

  • docs/security-topology.md:30 — security properties bullet
  • docs/architecture.md:212 — Delegation Flow section intro
  • docs/roles.md:97 — Agent endpoint table
  • docs/common-tasks.md:681 — Python helper docstring
  • docs/common-tasks.md:842 — error-help table
  • docs/integration-patterns.md:2095 — Scope and Delegation checklist

Diagram (1 edit, 1 SVG) — gets screenshotted into slides:

  • docs/diagrams/security-topology.svg:191-192 — Scope Attenuation callout label

Test plan

  • go vet ./... — PASS
  • go build ./... — PASS
  • gofmt -l . — no files need formatting
  • go test -short -count=1 ./... — full module, all packages green (cmd/awrit, cmd/broker, internal/admin, internal/app, internal/audit, internal/authz, internal/cfg, internal/deleg, internal/handler, internal/identity, internal/keystore, internal/mutauth, internal/revoke, internal/store, internal/token)
  • go mod verify && go mod tidy — clean
  • Contamination gate — clean
  • CI: gates.sh full (lint, gosec, govulncheck, race tests, docker-build, smoke-l25, sbom) — runs on this PR

devonartis and others added 2 commits April 15, 2026 00:01
…riving

commit.template (.gitmessage) only fires when git opens an editor, so
commits made via `git commit -m` or HEREDOC bypass it entirely. That is
why "Co-authored-by: Claude" stopped appearing on commits after 2026-03-30
when the workflow shifted to -m-based commits via Claude Code.

The hook gates on CLAUDECODE=1 so only Claude-driven commits are stamped;
solo commits made in a plain terminal are left untouched. Also normalizes
historical variants ("Claude Opus 4.6", "Claude Sonnet 4.6") to the
canonical "Claude <noreply@anthropic.com>" form.

Co-authored-by: Claude <noreply@anthropic.com>
Closes #41

Comments and docs in 9 places claimed delegation enforces strict
narrowing ("strict subset", "only narrow", "narrower-scoped"). The
actual code in authz.ScopeIsSubset is a non-strict containment check:
equal scopes pass. Same-scope delegation is a deliberate pattern
(e.g., fan-out to workers carrying the parent's full authority) and
is verified by the SDK acceptance suite (Story 8: "Delegate All
Scope (No Narrowing)").

Wording template applied: "cannot widen; equal or narrower is
accepted." The two source-file docstrings (deleg_svc.go, scope.go)
get a longer explanation noting same-scope delegation is intentional,
with a back-reference to issue #41 per golang.md's rule on commenting
non-obvious design choices.

Changes (12 distinct edits across 9 files):

  Source code (3 edits, 2 files)
  - internal/deleg/deleg_svc.go:6   "narrower-scoped token" → "scope-attenuated token (equal or narrower)"
  - internal/deleg/deleg_svc.go:12  "strict subset" → "cannot widen; equal or narrower" (+ rationale + #41 ref)
  - internal/authz/scope.go:74-78   "scopes can only narrow, never expand" → "requested scopes cannot widen allowed scopes" (+ rationale + #41 ref)

  README (2 edits)
  - README.md:39  "permissions only narrow, never expand" → "permissions cannot widen, only equal or narrower"
  - README.md:43  "delegate narrower-scoped tokens" → "delegate scope-attenuated tokens (equal or narrower)"

  Docs (6 edits, 5 files)
  - docs/security-topology.md:30      "scopes can only narrow, never escalate" → "scopes cannot widen; equal or narrower is accepted"
  - docs/architecture.md:212          "delegates a narrower-scoped token" → "delegates a scope-attenuated token (equal or narrower)"
  - docs/roles.md:97                  "Create a narrower-scoped token" → "Create a scope-attenuated token (equal or narrower)"
  - docs/common-tasks.md:681          docstring "narrower-scoped token" → "scope-attenuated token (equal or narrower)"
  - docs/common-tasks.md:842          error table "strict subset of your scope" → "does not widen your scope (equal or narrower is accepted)"
  - docs/integration-patterns.md:2095 checklist "always narrows scope" → "does not widen scope (equal or narrower)"

  Diagram (1 edit, 1 SVG, 2 text elements)
  - docs/diagrams/security-topology.svg:191-192  "Scopes can only narrow / Never escalate" → "Scopes cannot widen / Equal or narrower"

Verified already-correct (no change needed):
- docs/api.md:1057 "same or narrower, never wider" — accurate
- ErrScopeViolation = "delegated scope exceeds delegator scope" — accurate (talks about exceeding, not failing-to-narrow)

Local gates run pre-push: build, vet, format, contamination, unit-tests
(all packages), go-mod-verify — all PASS. Lint/gosec/govulncheck run
authoritatively in CI.

Co-authored-by: Claude <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 15, 2026

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Snapshot Warnings

⚠️: No snapshots were found for the head SHA 9ad1c1b.
Ensure that dependencies are being submitted on PR branches and consider enabling retry-on-snapshot-warnings. See the documentation for more information and troubleshooting advice.

Scanned Files

None

Co-authored-by: Claude <noreply@anthropic.com>
@devonartis devonartis merged commit 7aed833 into develop Apr 15, 2026
20 checks passed
@devonartis devonartis deleted the fix/delegation-narrowing-docs branch April 15, 2026 11:54
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.

1 participant