Commit f86f3bc
#334 fixed a HIGH boolean bug in the unauthenticated /v1/handle/intro filter
(the `&&`-chain accepted a kind=1100 event of ANY type, and a wrong-kind event
whose type happened to match) but added no test, so the exact bypass could
silently come back. Lock it:
- Extract the accept rule as a pure `intro_event_allowed(kind, type_str)` —
`kind == 1100 && (type_str == "pair_drop" || type_str == "agent_card")` — and
call it from the handler (no behavior change; just testable).
- Regression test asserts the full accept/reject matrix, with the two #334
bypass classes called out explicitly: (a) kind=1100 + any other type rejected,
(b) wrong-kind + matching type rejected.
Pure refactor + test only; the live filter logic is byte-equivalent to #334's
fix. 601 lib tests green, clippy clean.
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 0040dd2 commit f86f3bc
1 file changed
Lines changed: 33 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1863 | 1863 | | |
1864 | 1864 | | |
1865 | 1865 | | |
1866 | | - | |
| 1866 | + | |
1867 | 1867 | | |
1868 | 1868 | | |
1869 | 1869 | | |
| |||
2295 | 2295 | | |
2296 | 2296 | | |
2297 | 2297 | | |
| 2298 | + | |
| 2299 | + | |
| 2300 | + | |
| 2301 | + | |
| 2302 | + | |
| 2303 | + | |
| 2304 | + | |
| 2305 | + | |
| 2306 | + | |
| 2307 | + | |
| 2308 | + | |
2298 | 2309 | | |
2299 | 2310 | | |
2300 | 2311 | | |
| |||
2646 | 2657 | | |
2647 | 2658 | | |
2648 | 2659 | | |
| 2660 | + | |
| 2661 | + | |
| 2662 | + | |
| 2663 | + | |
| 2664 | + | |
| 2665 | + | |
| 2666 | + | |
| 2667 | + | |
| 2668 | + | |
| 2669 | + | |
| 2670 | + | |
| 2671 | + | |
| 2672 | + | |
| 2673 | + | |
| 2674 | + | |
| 2675 | + | |
| 2676 | + | |
| 2677 | + | |
| 2678 | + | |
| 2679 | + | |
| 2680 | + | |
2649 | 2681 | | |
0 commit comments