Commit 30fdb02
committed
fix(observability-map): attribute auth-boundary guards per export
Every input auth-boundary read was entry-point-wide, so one guarded export
spoke for the whole file: calleeNames is the union of both bodies,
checkedCallees was too, and usesBuilder was an OR over both initializer
callees. A file whose loader called requireUser and whose action called
nothing read as guarded in the body, and a createLoaderApiRoute loader
authenticated a hand-written action beside it. This is the same defect
auth-scope was fixed for a round earlier, in its sibling check.
scanFile now splits calleeNames, calleeTexts, checkedCallees, statementCount
and hasTryCatch per export, filled from one push site each so the union and
the split cannot drift apart. usesBuilder had no other caller and is gone.
routeExports is the single enumeration of a file's exports, shared with
auth-scope, which had grown its own [loader, action] literal.
Triviality had to follow, or the fix trades a false pass for a false
accusation: naive per-export attribution moved auth.github.ts and
auth.google.ts to fail, both being a one-line redirect-stub loader beside a
guarded action that the entry-point-wide rule called non-trivial. isTrivial
is now one rule over two views. The per-export view matches the side-effect
hints against that export's own callee paths: the whole file is defeatable
(the corpus's log-caller-scope-userid puts the word logger in the file and
un-excuses the untouched loader) and nothing at all guts the check (five
fixtures go from fail to not-applicable, because calleeNames keeps only a
call's last segment and prisma.x.findMany reads as findMany).
login.mfa's action verifies a TOTP or recovery code, which is a login-surface
proof of possession like the verify* guards already listed, so it joins them
rather than being accused once its loader stops speaking for it.
Real tree unmoved: global 19, 62 auth-boundary applicable, 59 passing, no
route changing any check.
scan.ts also picks up routeModuleFiles here, shared with the corpus harness,
because it sits in the same hunk as the per-export return shape.1 parent 4ea20b0 commit 30fdb02
10 files changed
Lines changed: 766 additions & 132 deletions
File tree
- internal-packages/observability-map/src
- checks
Lines changed: 68 additions & 23 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
4 | | - | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
9 | | - | |
10 | | - | |
11 | | - | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
12 | 14 | | |
13 | 15 | | |
14 | 16 | | |
| |||
66 | 68 | | |
67 | 69 | | |
68 | 70 | | |
69 | | - | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
70 | 76 | | |
71 | 77 | | |
72 | 78 | | |
| 79 | + | |
| 80 | + | |
73 | 81 | | |
74 | 82 | | |
75 | 83 | | |
76 | 84 | | |
77 | | - | |
78 | | - | |
| 85 | + | |
| 86 | + | |
79 | 87 | | |
80 | 88 | | |
81 | 89 | | |
| |||
85 | 93 | | |
86 | 94 | | |
87 | 95 | | |
88 | | - | |
| 96 | + | |
89 | 97 | | |
90 | 98 | | |
91 | 99 | | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
92 | 133 | | |
93 | 134 | | |
94 | 135 | | |
| |||
123 | 164 | | |
124 | 165 | | |
125 | 166 | | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
136 | 175 | | |
137 | 176 | | |
138 | | - | |
139 | | - | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
140 | 181 | | |
141 | 182 | | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
142 | 187 | | |
143 | 188 | | |
144 | | - | |
145 | | - | |
| 189 | + | |
| 190 | + | |
146 | 191 | | |
147 | 192 | | |
148 | 193 | | |
Lines changed: 15 additions & 22 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
| |||
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
15 | 19 | | |
16 | 20 | | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
39 | 32 | | |
40 | 33 | | |
41 | 34 | | |
| |||
Lines changed: 0 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
118 | 118 | | |
119 | 119 | | |
120 | 120 | | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | 121 | | |
129 | 122 | | |
130 | 123 | | |
| |||
0 commit comments