Commit e700a08
docs: align delegation framing with non-strict subset behavior
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>1 parent b8789f2 commit e700a08
9 files changed
Lines changed: 22 additions & 15 deletions
File tree
- docs
- diagrams
- internal
- authz
- deleg
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | | - | |
| 39 | + | |
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
43 | | - | |
| 43 | + | |
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
209 | 209 | | |
210 | 210 | | |
211 | 211 | | |
212 | | - | |
| 212 | + | |
213 | 213 | | |
214 | 214 | | |
215 | 215 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
678 | 678 | | |
679 | 679 | | |
680 | 680 | | |
681 | | - | |
| 681 | + | |
682 | 682 | | |
683 | 683 | | |
684 | 684 | | |
| |||
839 | 839 | | |
840 | 840 | | |
841 | 841 | | |
842 | | - | |
| 842 | + | |
843 | 843 | | |
844 | 844 | | |
845 | 845 | | |
| |||
Loading
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2092 | 2092 | | |
2093 | 2093 | | |
2094 | 2094 | | |
2095 | | - | |
| 2095 | + | |
2096 | 2096 | | |
2097 | 2097 | | |
2098 | 2098 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
97 | | - | |
| 97 | + | |
98 | 98 | | |
99 | 99 | | |
100 | 100 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
| 30 | + | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
75 | | - | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
76 | 79 | | |
77 | 80 | | |
78 | 81 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
7 | | - | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
12 | | - | |
13 | | - | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
14 | 18 | | |
15 | 19 | | |
16 | 20 | | |
| |||
0 commit comments