test(relay): lock the handle_intro security filter against regression (#334 follow-up)#335
Merged
Merged
Conversation
…#334 follow-up) #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>
Deploying wireup-landing with
|
| Latest commit: |
32c7a31
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://eab42f88.wireup-landing.pages.dev |
| Branch Preview URL: | https://test-lock-intro-filter-secur.wireup-landing.pages.dev |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Fast-follow to #334. That PR fixed a HIGH boolean bug in the unauthenticated
/v1/handle/introfilter but shipped no test — so the exact bypass could silently regress. This locks the security property.intro_event_allowed(kind, type_str)=kind == 1100 && (type_str == "pair_drop" || type_str == "agent_card")and calls it from the handler (no behavior change — byte-equivalent to fix: 4 security issues from code audit #334's fix).kind=1100+ any other type → rejectedWhy
A security fix without a property-locking test is one careless refactor away from reopening the hole. The HIGH filter now has a guard that fails CI if the accept matrix ever drifts.
Pure refactor + test only. 601 lib tests green, clippy
-D warningsclean.