Implement CBOR parser following ASN.1 paradigm with full test coverage#23
Open
Implement CBOR parser following ASN.1 paradigm with full test coverage#23
Conversation
Co-authored-by: polybassa <1676055+polybassa@users.noreply.github.com>
…oper half-float decoding Co-authored-by: polybassa <1676055+polybassa@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Implement CBOR parser following ASN.1 paradigm
Implement CBOR parser following ASN.1 paradigm
Feb 9, 2026
Copilot stopped work on behalf of
polybassa due to an error
February 11, 2026 19:44
Co-authored-by: polybassa <1676055+polybassa@users.noreply.github.com>
Co-authored-by: polybassa <1676055+polybassa@users.noreply.github.com>
Copilot
AI
changed the title
Implement CBOR parser following ASN.1 paradigm
Add cbor2 interoperability tests for CBOR parser validation
Feb 11, 2026
Co-authored-by: polybassa <1676055+polybassa@users.noreply.github.com>
Copilot
AI
changed the title
Add cbor2 interoperability tests for CBOR parser validation
Add CBOR documentation to advanced_usage.rst
Feb 11, 2026
Copilot
AI
changed the title
Add CBOR documentation to advanced_usage.rst
Implement RFC 8949 CBOR parser following ASN.1 architecture
Feb 11, 2026
polybassa
approved these changes
Feb 11, 2026
Co-authored-by: polybassa <1676055+polybassa@users.noreply.github.com>
Copilot
AI
changed the title
Implement RFC 8949 CBOR parser following ASN.1 architecture
Add adapted CBOR tests from PR #4875 for RFC 8949 compliance validation
Feb 11, 2026
… file opens Co-authored-by: polybassa <1676055+polybassa@users.noreply.github.com>
Copilot
AI
changed the title
Add adapted CBOR tests from PR #4875 for RFC 8949 compliance validation
Fix UTF-8 test failures on Windows by specifying encoding in file opens
Feb 11, 2026
… section Co-authored-by: polybassa <1676055+polybassa@users.noreply.github.com>
Copilot
AI
changed the title
Fix UTF-8 test failures on Windows by specifying encoding in file opens
Remove trailing whitespace in CBOR documentation causing Sphinx build warning
Feb 11, 2026
Co-authored-by: polybassa <1676055+polybassa@users.noreply.github.com>
Copilot
AI
changed the title
Remove trailing whitespace in CBOR documentation causing Sphinx build warning
Add RandCBORObject for fuzzing following ASN.1 paradigm
Feb 13, 2026
…re generation Co-authored-by: polybassa <1676055+polybassa@users.noreply.github.com>
Copilot
AI
changed the title
Add RandCBORObject for fuzzing following ASN.1 paradigm
Fix exponential complexity in CBOR fuzzing test generation
Feb 13, 2026
…ertions Co-authored-by: polybassa <1676055+polybassa@users.noreply.github.com>
Copilot
AI
changed the title
Fix exponential complexity in CBOR fuzzing test generation
Implement CBOR parser following ASN.1 paradigm with full test coverage
Feb 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Implements RFC 8949 CBOR (Concise Binary Object Representation) parser and encoder in Scapy, following the same architectural pattern as ASN.1 (separation of type system from codec).
Implementation
Core Components (
scapy/cbor/)cbor.py: Type system withCBOR_Objectbase class, major type objects (0-7), andCBOR_MajorTypesregistry using metaclass patterncborcodec.py: Codec withCBORcodec_Objectencoders/decoders, including IEEE 754 half-precision float conversionRandCBORObject: Fuzzing support with gaussian distribution for integers, exponential sizing for collections, depth limiting for nested structuresType Coverage
Testing
Test Suite (
test/scapy/layers/cbor.uts)Interoperability
cbor2library (test-only dependency)Platform Fixes
Windows UTF-8 handling (
scapy/tools/UTscapy.py)Windows defaults to cp1252, causing 'café' to misread as 'café'.
UTScapy test format
Documentation
Added CBOR section to
doc/scapy/advanced_usage.rstmirroring ASN.1 structure with usage examples, type descriptions, and interoperability notes.Dependencies
Added
cbor2totox.initest dependencies for interoperability validation (used only in tests, not in implementation).Example Usage
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.