Skip to content

bpf: object bodies beginning with "HTTP/1." are captured as a response head #3

Description

@echemythia

looks_like_http_response (bpf/include/s3tap_parse.h) is a pure 7-byte prefix test for
HTTP/1., and ssl_read_capture (bpf/src/s3tap.bpf.c) calls it on every SSL_read
return with no per-connection state.

So an S3 object whose bytes happen to begin with HTTP/1. — an HTTP log, a proxy capture,
an .http fixture — is treated as a response head. Up to ~4095 bytes of real object
content are copied into evt_tls_data, reach userspace, and can be printed unlabeled by
--dump-events.

This is currently an ACCEPTED tradeoff, documented at the recognizer, at the call site, and
pinned by name in bpf/tests/parser_tests.c
("http: a body chunk beginning with a status line IS misread as a head (accepted)").
Filing it so the acceptance is a tracked decision rather than only a comment.

Suggested fix

A per-(tgid, ssl) "a response is expected now" bit: set when a request write is captured,
cleared when a response head is consumed. The recognizer then only fires at a genuine
message boundary instead of on arbitrary body bytes.

Needs a new LRU map and correct handling of pipelined/persistent connections carrying
several in-flight request/response pairs, so it is a capture-path design change rather than
a small patch.

Affected

bpf/include/s3tap_parse.h, bpf/src/s3tap.bpf.c (ssl_read_capture),
crates/s3tap-cli/src/main.rs (--dump-events rendering).

Metadata

Metadata

Assignees

No one assigned

    Labels

    capture-correctnessCapture completeness or correctnesscoreHTTP/S3 parsing, event correlation and request assemblyebpfeBPF programs, maps, uprobes, tracepoints and kernel ABIknown-limitationAccepted limitation documented for usersprivacyPrivacy or sensitive-data exposure boundary

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions