Repository navigation
fix(pcapng): repoint TLSKeyLabel at RFC 9850, add ECH_SECRET/ECH_CONFIG - #883
Conversation
- pcapkit/protocols/misc/pcapng.py: TLSKeyLabel drifted from the Mozilla NSS key-log wiki that draft-ietf-opsawg-pcapng-06 S4.7 used to cite; it now points at RFC 9850's S4.2 "TLS SSLKEYLOGFILE Labels" registry. Add the two labels that registry defines and we were missing, ECH_SECRET and ECH_CONFIG, each with a #: comment transcribed from the registry table. ECH_SECRET keeps the file's # nosec B105 convention (bandit flags the SECRET substring); ECH_CONFIG does not need it. RSA has no row in that registry -- it is an NSS-only label removed in NSS 3.34 -- so it is kept, not deleted, and documented as the historical exception. The class docstring now cites RFC 9850. - pcapkit/vendor/pcapng/secrets_type.py: repoint the "NSS Key Log Format" comment at RFC 9850, matching the new authority. - tests/protocols/misc/test_pcapng_unit.py: pin TLSKeyLabel's member set against RFC 9850's registry plus the documented RSA exception, and assert ECH_SECRET, ECH_CONFIG and RSA all resolve. Verified: new test fails on the pre-fix pcapng.py (missing ECH_SECRET and ECH_CONFIG) and passes after; full test_pcapng_unit.py (94 tests) is green. Fixes #882
|
GOOD TO GO on It went past the RFC and checked the live registry, which is the right instinct given RFC 9850's registry is Specification Required and could have moved since July 2026. Fetched I re-ran that fetch myself: 10 rows, the same 10 labels, and Other findings, each with its own evidence:
And it caught an imprecision in my own issue text, which I have verified and fixed in the PR description. Draft-06 §4.7 does not literally name RFC 9850 — line 2380 reads "This format is described in [I-D.ietf-tls-keylogfile]", resolved at line 3206 as Not verified, stated rather than glossed: CI: 55 green, 0 failed, 3 still in flight. Unpublished and unmerged, yours to merge. |
…registry - Add pcapkit/vendor/pcapng/tls_key_label.py, a new crawler fetching the IANA "TLS SSLKEYLOGFILE Labels" CSV (RFC 9850 section 4.2) and generating pcapkit/const/pcapng/tls_key_label.py, matching the shape of its const/pcapng siblings (EnumRegistry + StrEnum, no _missing_, so lookup stays closed and raises exactly as it did before this move). The RFC citation is parsed from each row rather than assumed, and raises loudly on a reference it does not recognise instead of guessing one. - RSA has no row in the registry (NSS-only, removed in NSS 3.34) and is hand-carried by the crawler with its #883 comment preserved verbatim; the other 8 "*_SECRET*" members keep their `# nosec B105` suppression. - pcapkit/protocols/misc/pcapng.py now imports TLSKeyLabel from the new canonical module instead of defining it, and re-exports it under the same name so `from pcapkit.protocols.misc.pcapng import TLSKeyLabel` keeps working; the three other internal importers are left importing through that re-export, to avoid splitting their existing combined import with WireGuardKeyLabel, which stays put. Updated the one docstring elsewhere that named TLSKeyLabel's old StrEnum base, which this move changes from compat.StrEnum to aenum.StrEnum. - Register the new crawler/const module in the vendor/const __init__.py index files and docs, and pin the const-enum sweep tests' updated counts in both files that census pcapkit/const's population. - Extend test_pcapng_unit.py to check the re-export identity, pin every member's value, and confirm unknown/lower-case labels still raise. Build/test: ran the crawler twice (byte-identical sha256), plus tests/protocols/misc/test_pcapng_unit.py (94/94) and the affected tests/const + tests/vendor + tests/project sweeps, all green.
…registry - Add pcapkit/vendor/pcapng/tls_key_label.py, a new crawler fetching the IANA "TLS SSLKEYLOGFILE Labels" CSV (RFC 9850 section 4.2) and generating pcapkit/const/pcapng/tls_key_label.py, matching the shape of its const/pcapng siblings (EnumRegistry + StrEnum, no _missing_, so lookup stays closed and raises exactly as it did before this move). The RFC citation is parsed from each row rather than assumed, and raises loudly on a reference it does not recognise instead of guessing one. - RSA has no row in the registry (NSS-only, removed in NSS 3.34) and is hand-carried by the crawler with its #883 comment preserved verbatim; the other 8 "*_SECRET*" members keep their `# nosec B105` suppression. - pcapkit/protocols/misc/pcapng.py now imports TLSKeyLabel as Enum_TLSKeyLabel, matching the alias every one of its seven pcapkit.const.pcapng siblings already carries in this file, and re-exports it under the original bare name (`TLSKeyLabel = Enum_TLSKeyLabel`) so `from pcapkit.protocols.misc.pcapng import TLSKeyLabel` keeps resolving to the identical object; the three other internal importers are left importing through that re-export, to avoid splitting their existing combined import with WireGuardKeyLabel, which stays put and hand-written (the alias convention is about imports of const enums, not local definitions). Updated the one docstring elsewhere that named TLSKeyLabel's old StrEnum base, which this move changes from compat.StrEnum to aenum.StrEnum. - Register the new crawler/const module in the vendor/const __init__.py index files and docs, and pin the const-enum sweep tests' updated counts in both files that census pcapkit/const's population. - Extend test_pcapng_unit.py to check the re-export identity, pin every member's value, and confirm unknown/lower-case labels still raise. Build/test: ran the crawler twice (byte-identical sha256), plus tests/protocols/misc/test_pcapng_unit.py (94/94) and the affected tests/const + tests/vendor + tests/project sweeps, all green.
…registry (#890) - Add pcapkit/vendor/pcapng/tls_key_label.py, a new crawler fetching the IANA "TLS SSLKEYLOGFILE Labels" CSV (RFC 9850 section 4.2) and generating pcapkit/const/pcapng/tls_key_label.py, matching the shape of its const/pcapng siblings (EnumRegistry + StrEnum, no _missing_, so lookup stays closed and raises exactly as it did before this move). The RFC citation is parsed from each row rather than assumed, and raises loudly on a reference it does not recognise instead of guessing one. - RSA has no row in the registry (NSS-only, removed in NSS 3.34) and is hand-carried by the crawler with its #883 comment preserved verbatim; the other 8 "*_SECRET*" members keep their `# nosec B105` suppression. - pcapkit/protocols/misc/pcapng.py now imports TLSKeyLabel as Enum_TLSKeyLabel, matching the alias every one of its seven pcapkit.const.pcapng siblings already carries in this file, and re-exports it under the original bare name (`TLSKeyLabel = Enum_TLSKeyLabel`) so `from pcapkit.protocols.misc.pcapng import TLSKeyLabel` keeps resolving to the identical object; the three other internal importers are left importing through that re-export, to avoid splitting their existing combined import with WireGuardKeyLabel, which stays put and hand-written (the alias convention is about imports of const enums, not local definitions). Updated the one docstring elsewhere that named TLSKeyLabel's old StrEnum base, which this move changes from compat.StrEnum to aenum.StrEnum. - Register the new crawler/const module in the vendor/const __init__.py index files and docs, and pin the const-enum sweep tests' updated counts in both files that census pcapkit/const's population. - Extend test_pcapng_unit.py to check the re-export identity, pin every member's value, and confirm unknown/lower-case labels still raise. Build/test: ran the crawler twice (byte-identical sha256), plus tests/protocols/misc/test_pcapng_unit.py (94/94) and the affected tests/const + tests/vendor + tests/project sweeps, all green.
The paragraph claimed the defect programme ran "across some 140 issues and pull requests between #326 and #509" and reached "#805 by the entries below". Both are wrong, and re-measuring on this revision gives: * 254 distinct issue/PR references in the entries, not ~140. * 87 of them fall in [#326, #509]; 164 are above #509 and 3 below #326. * The highest is #883, not #805. The range framing was the root cause -- it encoded the window the programme opened on as though it were its extent, so every merge since made it more wrong. Replaced with a snapshot that says it is one, and regenerated CHANGELOG.md so the two stay in step (`util/changelog_md.py --check` exits 0).
Please follow the guide below
You will be asked some questions, please read them carefully and answer honestly
Put an
xinto all the boxes [ ] relevant to your pull request (like that [x])Use Preview tab to see how your pull request will actually look like
Searched for similar pull requests
Followed the coding style (
make pylint,make mypy,make isort)make testpasses, and a test case covers the changeAdded a changelog entry under
docs/source/changelog/and regeneratedCHANGELOG.md, if the change is user-visible -- N/A -- changelog centralised in docs(changelog): shared 1.5.0 changelog — long-lived, merges last (#610, #616, #617, #618, #620) #657What is the purpose of your pull request?
Tick the commit type your subject line carries.
fix— corrects a defectfeat— adds a featureperf— changes performance, not behaviourrefactor— changes neither behaviour nor performancetest— tests onlydocs— documentation onlyci— workflows or build toolingchore— anything elseDescription of your pull request and other information
TLSKeyLabeltracked the Mozilla NSS key-log wiki, butdraft-ietf-opsawg-pcapng-06S4.7 nowpoints at
[I-D.ietf-tls-keylogfile](draft-05), published as RFC 9850, "The SSLKEYLOGFILE Format for TLS", whose S4.2 creates the IANA "TLSSSLKEYLOGFILE Labels" registry.
Against that registry we were missing
ECH_SECRETandECH_CONFIG(RFC 9850 SS2.3/4.2), soTLSKeyLabel('ECH_SECRET')raisedValueErroron an otherwise-legitimate Decryption SecretsBlock. Both are added with a
#:comment transcribed from the registry table;ECH_SECRETkeepsthe file's
# nosec B105bandit convention for*_SECRETmembers,ECH_CONFIGdoesn't need it.RSAhas no row in RFC 9850's registry -- it's an NSS-only label the NSS wiki records as removedin NSS 3.34. Kept rather than deleted (removing a public member is a breaking change) and
documented as the historical exception.
Also repoints
secrets_type.py's stale# NSS Key Log Formatcomment at RFC 9850, and cites RFC9850 in
TLSKeyLabel's docstring. Added a test pinning the member set against RFC 9850 plus thedocumented
RSAexception, and assertingECH_SECRET/ECH_CONFIG/RSAall resolve.Fixes #882