Commit bbd86ed
fix(scripts): anchor check-org-identifier on session provenance, not the receiver name (#9810)
* fix(scripts): anchor check-org-identifier on session PROVENANCE, not the receiver name (#9691)
The detector was one line — `/\bsession\s*\??\.\s*tenantId\b/` — so it graded a
receiver only when it was literally spelled `session`. Census over the 2057
scanned files: 111 `.tenantId` reads, ZERO of them spelled `session`, and 2
reached through a local bound from `….session`. The gate matched nothing in the
corpus for its whole life while printing "no removed session.tenantId alias".
Adds a second rule anchored on where the value came from: a local or a same-file
function parameter filled from an expression ending in `.session` is a session,
whatever it is called, and a `.tenantId` read off one is a finding. Propagation
is transitive and scope-resolved, so the same name in another function is not a
false red. The text rule is unchanged and still owns the literal spelling and
the authoring-sample-inside-a-string case.
Also prints the discovered binding population and fails at zero — this gate
certified a corpus it could not read, so an empty population is a broken scan,
not a clean repo.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XqDQYVU5smx29ts9pAErja
* fix(service-storage,plugin-audit): read the caller org under the blessed name in the access-hook session fallback (#9691)
The two live reads the widened check:org-identifier now sees. Both spell the
receiver `s`, bound from `ctx?.session`, which is why the name-anchored gate
scored zero on them for their whole life.
- service-storage attachment kit: `tenantId: s.tenantId` had NO fallback, so
the envelope forwarded to ISharingService.canEdit carried no org at all on
the session-fallback path. Genuinely defective, not merely invisible.
- plugin-audit comment kit: `s.tenantId ?? s.organizationId` — dead first arm,
behaviour-neutral removal.
The attachment kit's existing coverage of that path pinned the dead arm: it
handed the hook a session spelling `tenantId`, a shape HookContextSchema strips
and buildSession never emits, so it passed for exactly as long as the code was
wrong. Replaced with the envelope a real transport builds, plus a mirror pin in
both kits that a stray removed-alias key does not become the org.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XqDQYVU5smx29ts9pAErja
* docs(plugin-audit): correct the audit-writers pin note that named check:org-identifier as blind to `sess` (#9691)
The comment was written when the gate anchored on the literal receiver name.
It now resolves the receiver's provenance, so the claim it makes is false as
of the commit that introduced this line's own subject.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XqDQYVU5smx29ts9pAErja
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 526a436 commit bbd86ed
7 files changed
Lines changed: 613 additions & 49 deletions
File tree
- .changeset
- packages
- plugins/plugin-audit/src
- services/service-storage/src
- scripts
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1657 | 1657 | | |
1658 | 1658 | | |
1659 | 1659 | | |
1660 | | - | |
1661 | | - | |
| 1660 | + | |
| 1661 | + | |
| 1662 | + | |
| 1663 | + | |
| 1664 | + | |
| 1665 | + | |
| 1666 | + | |
1662 | 1667 | | |
1663 | 1668 | | |
1664 | 1669 | | |
| |||
Lines changed: 36 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
495 | 495 | | |
496 | 496 | | |
497 | 497 | | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
498 | 534 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
252 | 252 | | |
253 | 253 | | |
254 | 254 | | |
255 | | - | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
256 | 262 | | |
257 | 263 | | |
258 | 264 | | |
| |||
Lines changed: 31 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
711 | 711 | | |
712 | 712 | | |
713 | 713 | | |
714 | | - | |
715 | | - | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
716 | 726 | | |
717 | 727 | | |
718 | 728 | | |
719 | 729 | | |
720 | 730 | | |
721 | 731 | | |
722 | | - | |
| 732 | + | |
| 733 | + | |
723 | 734 | | |
724 | 735 | | |
| 736 | + | |
| 737 | + | |
725 | 738 | | |
726 | 739 | | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
727 | 755 | | |
Lines changed: 11 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
134 | 134 | | |
135 | 135 | | |
136 | 136 | | |
137 | | - | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
138 | 148 | | |
139 | 149 | | |
140 | 150 | | |
| |||
0 commit comments