Skip to content

test(relay): lock the handle_intro security filter against regression (#334 follow-up)#335

Merged
laulpogan merged 1 commit into
mainfrom
test/lock-intro-filter-security-property
Jun 17, 2026
Merged

test(relay): lock the handle_intro security filter against regression (#334 follow-up)#335
laulpogan merged 1 commit into
mainfrom
test/lock-intro-filter-security-property

Conversation

@laulpogan

Copy link
Copy Markdown
Collaborator

What

Fast-follow to #334. That PR fixed a HIGH boolean bug in the unauthenticated /v1/handle/intro filter but shipped no test — so the exact bypass could silently regress. This locks the security property.

  • Extracts the accept rule as a pure 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).
  • Regression test asserts the full accept/reject matrix, with the two fix: 4 security issues from code audit #334 bypass classes called out explicitly:
    • (a) kind=1100 + any other type → rejected
    • (b) wrong-kind + matching type → rejected

Why

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 warnings clean.

…#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>
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying wireup-landing with  Cloudflare Pages  Cloudflare Pages

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

View logs

@laulpogan laulpogan merged commit f86f3bc into main Jun 17, 2026
13 checks passed
@laulpogan laulpogan deleted the test/lock-intro-filter-security-property branch June 17, 2026 04:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant