Repository navigation
fix(pcapng): rebuild a ZigBee key off its fixed width as captured (#1986) - #2001
Conversation
) A Decryption Secrets Block's ZigBee NWK or APS key has a fixed width, but Secrets Length may declare fewer octets or more. - A short key parsed, but its data model rebuilt it zero-padded at full width, with Secrets Length rewritten and the block grown. The data model now keeps the Secrets Data octets as the block holds them, as a TLS key log keeps its text, and zigbee_key_held rebuilds the schema from them, recording a short read so packing cuts it back. - Octets past the fixed width were dropped by the parse itself, so even the header packed short of its Block Total Length. Both key schemas now keep them in a trailing field. - A Secrets Length past the block now rebuilds for a ZigBee key too, and the #1980 test that pinned the dropped octets now pins byte-exact.
|
GOOD TO GO at
Every block rebuilt byte-exact. Pickle, deepcopy, equality and The new test fails on |
|
Coverage: 91.54% (unit tier, Python 3.15,
Per-file detail: the |
make pylint,make mypy,make isort)make testpasses, and a test case covers the changeWhat is the purpose of your pull request?
fix— corrects a defectDescription of your pull request and other information
A Decryption Secrets Block holding a ZigBee NWK or APS key off its fixed width now rebuilds byte-exact. Before, a short key was zero-padded to full width, and
secrets_lengthgrew to match. Key octets beyond the fixed width that still fitted inside the block were dropped.dataattribute, which is set on parse only. This follows the TLS key-log precedent.zigbee_key_heldrebuilds the key schema from those octets. A short key packs back short.trailingfield keeps any octets past the fixed width.The other secret types (TLS, WireGuard and unknown) already span the whole secrets area, so they are unaffected.
test_pcapng_zigbee_key_width_1986_unit.pycovers every short width, long keys, overruns, make→parse and building from fields. It fails onmainwith 60 failures and passes here.Two assertions in the #1980 tests pinned the old full-width rebuild, so they now assert a byte-exact one.
Closes #1986