Commit 8953f21
fix(rbac): preserve colons in scope resource ids
`buildJwtAbility` parsed scopes with `[a, b, c] = scope.split(":")`
which captures only the first three segments. A scope like
`read:tags:env:staging` (a tag id containing a colon) lost everything
after the second colon — `scopeId` became `"env"`, and the tag
`{ type: "tags", id: "env:staging" }` silently failed to match.
Fix: split into all parts, then take everything after the second
colon as the resource id (`parts.slice(2).join(":")`). Two-segment
scopes (`read:tags`) still produce `scopeId === undefined`,
preserving the type-level wildcard semantic.
Test coverage added for the multi-colon-id path. The bug was
pre-existing in the legacy `checkAuthorization` too — system-generated
ids (friendlyIds like `run_abc`) use underscores, so the issue only
surfaced for user-provided strings (tags), which made it easy to miss.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent ee13f2b commit 8953f21
2 files changed
Lines changed: 20 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
56 | 67 | | |
57 | 68 | | |
58 | 69 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
30 | 38 | | |
31 | 39 | | |
32 | 40 | | |
| |||
0 commit comments