Skip to content

feat(application): dissect every whole SSLv2 record in a TCP segment - #2585

Merged
JarryShaw merged 2 commits into
mainfrom
feat/2567-sslv2-segment-records
Nov 1, 2026
Merged

JarryShaw merged 2 commits into
mainfrom
feat/2567-sslv2-segment-records

Conversation

@JarryShaw

Copy link
Copy Markdown
Owner

What is the purpose of your pull request?

  • feat — adds a feature

Description of your pull request and other information

SSLv2 now dissects every whole record in a TCP segment. Each record after the first is the previous record's payload, the way #2517 chains TLS. A later record that fails to decode is Raw with the rest of the segment and the error set. A record cut short stays Raw with no error.

TLS's SSLv2 fallback now passes the caller's parse stops (layer=, protocol=) and __context__ to its trial. So a stop at SSLv2, TLS or SSL holds behind TCP 443, and every chained record carries the caller's context registry.

Closes #2567

…2567)

- SSLv2._import_next_layer dissects a whole record opening the rest of the
  segment as a further SSLv2 layer, the previous record's payload, as TLS
  does; a header cut short or a record the segment ends inside stays Raw.
- A later record that fails to decode (RECORD-LENGTH 0) becomes Raw with
  everything after it, under beholder, carrying read()'s error.
- protocol=, layer= and FRAME_LAYER_LIMIT stop the chain; TLS's port-443
  SSLv2 fallback chains the same way.
- protocol-family-grouping.rst, "Chained Records": SSLv2 chains; DTLS
  still does not (#2535). sslv2.rst and the module docstring gain a
  "Records in One Segment" section.
- Tests: two and three records, a malformed later record, octets opening
  no record, the stops, and both round-trip directions.
- TLS._read_sslv2_fallback built its trial from kwargs that Protocol.__init__
  had already stripped of layer, protocol and __context__, so on TCP 443 a
  stop at SSLv2, TLS, SSL or the Application layer still chained the later
  records (TCP:SSLv2:SSLv2). The trial now gets the context, and the stops:
  this dispatcher's own layer when it matched one, otherwise its limits.
- sslv2.rst and the module docstring drop the "except behind the SSLv2
  fallback" clause.
- Tests: each stop form through TCP 443, plus a later record that fails to
  decode and one cut short, all byte-exact on rebuild; and a caller's
  context registry reaching every record after the first, which fails
  without the __context__ handoff.
@JarryShaw JarryShaw added feat Pull requests that add a new capability (feat: subject prefix) review: good-to-go Cross-review at the current head says ready; CI state is separate labels Nov 1, 2026
@JarryShaw

Copy link
Copy Markdown
Owner Author

GOOD TO GO at 40fec14f6. A Sonnet delta review covered the stop fix, and I checked the __context__ pin and the rebase myself.

  • The stops hold end to end, through TCP 443 and pcapkit.extract.
  • A differential of 45,451 parses against the base found 696 changes, all intended SSLv2 splits, and every one matches an independent record-length oracle.
  • Every rebuild is byte-exact, and TLS's rejected-trial warnings stay dropped (fix(application): a successful SSLv2 fallback still reports TLS's rejected header read #2525).
  • The new tests fail without the fix: the stop test fails on all four stop forms, and the __context__ pin with {} != {'SSLV2': …}.

@github-actions

github-actions Bot commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

Coverage: 94.04% (unit tier, Python 3.15, 40fec14f6, Unit Tests run success)

Package Statements Missed Branches Partial Cover
pcapkit (top level) 104 4 20 2 95.16%
pcapkit/const 20093 144 2712 125 98.78%
pcapkit/corekit 2605 74 818 37 96.52%
pcapkit/dumpkit 281 3 100 3 98.43%
pcapkit/foundation 3360 27 1186 32 98.70%
pcapkit/interface 138 4 52 3 96.32%
pcapkit/protocols 20271 207 5330 201 98.40%
pcapkit/toolkit 961 28 342 10 96.32%
pcapkit/utilities 506 7 144 5 98.15%
pcapkit/vendor 5009 2222 1148 182 52.31%

Per-file detail: the coverage-html artifact of this run.

@JarryShaw
JarryShaw merged commit 52059db into main Nov 1, 2026
65 checks passed
@JarryShaw
JarryShaw deleted the feat/2567-sslv2-segment-records branch November 1, 2026 23:52
@github-project-automation github-project-automation Bot moved this from In review to Done in PyPCAPKit Nov 1, 2026
@JarryShaw JarryShaw removed the review: good-to-go Cross-review at the current head says ready; CI state is separate label Nov 1, 2026
@github-actions github-actions Bot added this to the PyPCAPKit v1.6 milestone Nov 2, 2026
JarryShaw added a commit that referenced this pull request Nov 2, 2026
…1.6.0 (#2449)

- Added: DCCP, its checksum over the IP pseudo-header, register_dccp and
  register_dccp_option, and the pcapkit.const.dccp registries (#2593).
- Folded into unreleased entries: LinuxSLL's stop on its ARPHRD path
  (#2587) and ARPHRD's __proto_dest__ (#2598), SSLv2 records chained in a
  segment (#2585), the checksum's move to pcapkit.corekit.checksum.internet
  (#2586), and IGMPv2's and IGMPv3's versioned name (#2590).
- Breaking: InARP moves to pcapkit.protocols.link.inarp with no re-export,
  joining the DRARP entry (#2596).
- Changed: the conventions' new rulings (#2599), the milestone workflow's
  next-open-milestone lookup (#2591), the PyPy protocols shards (#2604).
  Fixed: a handled next-layer refusal is quiet under beholder (#2597); the
  IPX crawlers restore sys.path (#2601).
- CHANGELOG.md regenerated; util/changelog_md.py --check passes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feat Pull requests that add a new capability (feat: subject prefix)

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

feat(application): dissect every SSLv2 record in a TCP segment, not only the first

1 participant