Repository navigation
Commit cda9a4f
committed
fix(api): registry success payloads must not deref a nil entry
redactedRegistrySummary (#1164) dereferences its argument, and all three
registry handlers — add, edit and remove — called it on the SUCCESS path with no
nil check. A controller reporting success without an entry therefore panicked
inside the handler, and chi's recoverer turned that into a bare 500 with an
EMPTY body: the caller saw an unexplained server error on a request that had
actually succeeded, and the cause survived only as a stack in the log.
Not hypothetical. MockServerController already returns (nil, nil, nil) from
these methods, so every test driving those routes through it hit the panic. It
surfaced as an intermittent windows-amd64 CI failure where the recovered panic
escaped the test process — intermittent because the recoverer usually swallows
it, which is exactly why it went unnoticed: the package stayed green while three
routes were answering 500 to successful requests.
The guard lives in the renderer rather than at the three call sites so a fourth
caller cannot reintroduce it. A nil entry now renders the zero summary, which
reports no identity and — deliberately — Trusted=false: nothing unknown may be
described as trusted.
Tests assert both that the routes do not panic and that the body is NON-EMPTY,
since an empty 500 is the signature of a recovered panic and a test that only
checked the status code would have passed throughout.1 parent 7d8b87b commit cda9a4f
2 files changed
Lines changed: 77 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
157 | 157 | | |
158 | 158 | | |
159 | 159 | | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
160 | 173 | | |
161 | 174 | | |
162 | 175 | | |
| |||
| 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 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
0 commit comments