Skip to content

e2e: two security assertions use 'rejection || !got_200', so a silent or crashed worker passes #1381

Closed

Description

@FlorentinDUBOIS

Observed on main at c7ac070e.

Two e2e security assertions are written as rejection || !got_200. Because
got_200 is derived from frames that may not arrive at all, the absence of any
response satisfies the assertion — the test passes when the worker says nothing.

e2e/src/tests/listener_update_tests.rs:560:

// Success: phase1 produced 421 or GOAWAY; patch succeeded; phase2 got a response.
let phase1_ok = got_rejection_or_421 || !got_200;

e2e/src/tests/h2_security_header_injection.rs:726:

let ok = protocol_rejection || !got_200;

The comment above the first states the intended contract precisely — "phase1
produced 421 or GOAWAY"
— and the code then accepts a third outcome the comment
does not mention.

What still works, and what does not

Both tests do catch their primary regression. If strict SNI binding stops rejecting,
sōzu proxies the mismatched authority and answers 200, got_200 is true, and the
test fails. That is the case these were written for.

What they cannot distinguish is a correct 421/GOAWAY from any other non-200
outcome: a 502, a 503, a silent connection reset, a timeout with zero frames
collected, a worker that died between phases. All of those set got_200 = false
and pass. A regression that turns a clean rejection into a crash reads as success.

listener_update_tests.rs has partial cover — still_alive and
got_response_after_patch would catch a worker that stayed dead — but the phase-1
assertion itself is unconditioned, and h2_security_header_injection.rs:726 has no
such backstop.

Second-order: payload.contains(&0x88)

Both sites detect 200 by scanning the whole HPACK block for the byte 0x88
(static index 8, :status 200) rather than decoding the :status field:

frames.iter().any(|(ft, _fl, sid, payload)| {
    *ft == H2_FRAME_HEADERS && *sid == 1 && payload.contains(&0x88)
})

0x88 can occur inside a Huffman-encoded literal value or as a length octet, so
the scan is false-positive-prone in the other direction. Combined with || !got_200
the assertion is loose on both sides. This is the same defect class as #1374, where
seventeen sites scan for 0x8D while claiming to assert 400.

Suggested fix

Assert the positive outcome directly: require got_421 || contains_goaway(..), and
separately require that frames were received at all. Decode :status from the HPACK
block rather than scanning for its static-table byte — the decoder the tests already
use for response bodies can serve here.

Activity

  1. added a commit that references this issue on Sep 21, 2026
    b96d946
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions