Skip to content

fix(corekit): a capture cut inside an option area is refused, and loudly, instead of a short read #2694

Closed

Description

@JarryShaw

Found while re-reviewing #2683; identical on main. Under the #1325 guards, OptionField.unpack refuses a capture cut that lands before or inside an option area: "runs past the end of the data" via _ShortReadTracker, and "consumed no data" from the zero-progress check. This hits 13 option-bearing MH message types, and HOPOPT cut to 2 or 3 octets.

  • Inside IPv6 the cut layer is kept as Raw and rebuilds byte for byte.
  • The "consumed no data" cases are not quiet. They log a CRITICAL FieldValueError and a beholder WARNING, against the handled-refusals-are-quiet rule.
  • Standalone, MH(cut) raises where a capture cut belongs to Schema's built-in short read.

Decide whether a cut inside an option area should parse via the built-in, as #2682 does for SCTP's padding. Either way, the refusal kept as Raw must log nothing.

Activity

  1. added this to the PyPCAPKit v1.6 milestone on Nov 2, 2026
  2. added
    bugIssues reporting a defect (set by the bug report template; a default, not an assessment)
    on Nov 2, 2026
  3. moved this to Pending in PyPCAPKiton Nov 2, 2026
  4. JarryShaw commented on Nov 2, 2026

    @JarryShaw
    OwnerAuthor

    Blocked on #2682, which reworks OptionField's #1325 guard for SCTP. This issue starts once that lands, so the two cannot conflict. blocked.

  5. added
    blockedDeferred pending another issue or decision; see the last comment for what unblocks it
    on Nov 2, 2026
  6. moved this from Pending to Blocked in PyPCAPKiton Nov 2, 2026
  7. JarryShaw commented on Nov 2, 2026

    @JarryShaw
    OwnerAuthor

    Another case of the same kind, from #2700's review and identical on main: MH option 44 with an odd length raises FieldValueError from corekit's list field. Inside IPv6 that logs five CRITICAL records, although the layer is kept as Raw. Option 48 logs seven records.

  8. JarryShaw commented on Nov 3, 2026

    @JarryShaw
    OwnerAuthor

    Another case of the same kind, found on #2691 and present on main: a capture cut inside the reserved octets of an MH LRI or UPA message raises a bare FieldValueError from the options field while parsing.

  9. JarryShaw commented on Nov 3, 2026

    @JarryShaw
    OwnerAuthor

    #2682 has merged as bd82b7632, and it already reads a cut option area as a short read for SCTP padding. A worker is extending the same Schema short-read mechanism to every case here, so that nothing is logged. wip.

  10. added
    wipWork in flight - a covering PR is open or an agent is actively on it
    and removed
    blockedDeferred pending another issue or decision; see the last comment for what unblocks it
    on Nov 3, 2026
  11. moved this from Blocked to WIP in PyPCAPKiton Nov 3, 2026
  12. JarryShaw commented on Nov 3, 2026

    @JarryShaw
    OwnerAuthor

    The worker has the MH part: a cut inside or before an MH option area, or inside the LRI/UPA reserved octets, now parses as a recorded short read through Schema's built-in, rebuilds byte-exactly and logs no refusal.

    Needs deciding: a standalone cut HOPOPT or IPv6-Opts. The schema now records the cut, but the layer still refuses it in its "options must fill the area" check. Inside IPv6 it stays a quiet, exact Raw; on its own, HOPOPT(cut) raises.

    1. Parse it as a short read. HOPOPT.make and IPv6_Opts.make then rebuild the declared Hdr Ext Len, as MH's maker does. This overturns A malformed known IPv6 extension header should parse as Raw, not IPv6_Ext #2477's test_cut_header_is_raw_and_ends_the_walk.
    2. Keep the refusal, with the cut header as Raw.

    Recommendation: 1. Your ruling puts capture cuts in Schema's built-in short read, and whatever parses also builds. I'm going ahead with 1 in this commit unless you pick 2. The odd-length MH options 44 and 48 from the second comment are going into the same commit.

  13. added
    needs: decisionWaiting on the maintainer to decide — not blocked by other work
    on Nov 3, 2026
  14. moved this from WIP to Needs decision in PyPCAPKiton Nov 3, 2026
  15. JarryShaw commented on Nov 3, 2026

    @JarryShaw
    OwnerAuthor

    take 1

  16. JarryShaw commented on Nov 3, 2026

    @JarryShaw
    OwnerAuthor

    Ruling taken: option 1. A standalone cut HOPOPT or IPv6-Opts header parses as a recorded short read. Their make() gains what it needs to rebuild the declared Hdr Ext Len, and #2477's test_cut_header_is_raw_and_ends_the_walk moves to the new behaviour, citing this issue.

    How this fits with the rest: the worker was already on option 1, so nothing changes in flight. The odd-length MH options 44 and 48 and the conventions paragraph for the short-read ruling go in the same commit. needs: decision is removed and the issue stays wip.

  17. removed
    needs: decisionWaiting on the maintainer to decide — not blocked by other work
    on Nov 3, 2026
  18. moved this from Needs decision to WIP in PyPCAPKiton Nov 3, 2026
  19. JarryShaw commented on Nov 3, 2026

    @JarryShaw
    OwnerAuthor

    The PR is #2731.

  20. removed
    wipWork in flight - a covering PR is open or an agent is actively on it
    on Nov 3, 2026
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

    bugIssues reporting a defect (set by the bug report template; a default, not an assessment)

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions