Repository navigation
Fix unsigned CoAP sizes and Observe deadlines; randomize automatic tokens - #38
Merged
Merged
Conversation
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues require resolution before approval.
No open issues 🎉
What changed in this PR
This PR fixes unsigned size handling and long Observe deadlines in CoAP.NET, while preserving existing signed APIs and request identities.
Changes:
- Adds full-range unsigned option APIs, Resource/MVC binding, and size-hint preservation during blockwise assembly.
- Uses monotonic Observe deadlines with bounded timer intervals and terminal-state cleanup.
- Generates automatic eight-byte tokens with the platform cryptographic random generator, with regression tests and compatibility documentation.
DTLS traffic-key-context token non-reuse remains unresolved. External interoperability, NativeAOT execution, package publication, and field qualification remain outside the reported validation.
| File | Description |
|---|---|
ROADMAP.md |
Summarizes implementation status and remaining validation gates. |
README.md |
Introduces unsigned sizes, bounded deadlines, and token changes. |
HANDOFF.md |
Records implementation details, validation, and follow-up work. |
docs/coap-standards-roadmap.md |
Updates standards issue status and interoperability limits. |
docs/coap-options-compatibility.md |
Documents API compatibility and remaining protocol work. |
docs/audits/coap-20261113/next-batch-validation.json |
Records validation results and unexecuted gates. |
docs/audits/coap-20261113/next-batch-execution.json |
Captures source hashes, commands, and execution receipts. |
CoAP.Test/UnsignedOptionTest.cs |
Tests unsigned boundaries, signed compatibility, and overflow rejection. |
CoAP.Test/UnsignedOptionHostingTest.cs |
Tests reflection and generated unsigned option binding. |
CoAP.Test/UnsignedBlockwiseSizeTest.cs |
Tests size-hint retention without size-driven allocation. |
CoAP.Test/TokenGenerationTest.cs |
Tests automatic tokens and preservation of existing identities. |
CoAP.Test/ObserveLongDeadlineTest.cs |
Tests deadline boundaries, updates, cancellation, and cleanup. |
CoAP.Test/EndpointOwnedExchangeTest.cs |
Updates Observe cleanup coverage for the new timer behavior. |
CoAP.Test/Codec/MessageTest.cs |
Corrects Content-Format to use an integer media-type value. |
CoAP.NET/Stack/TokenLayer.cs |
Replaces counter-based tokens with cryptographically random bytes. |
CoAP.NET/Stack/ObserveLayer.cs |
Implements monotonic deadlines, bounded scheduling, and timer cleanup. |
CoAP.NET/Stack/BlockwiseStatus.cs |
Stores unsigned size hints as scalar metadata. |
CoAP.NET/Stack/BlockwiseLayer.cs |
Preserves size hints when assembling incoming blocks. |
CoAP.NET/Server/Routing/CoapGeneratedEndpointHelpers.cs |
Adds unsigned option conversion for generated endpoints. |
CoAP.NET/Server/Routing/CoapActionParameterBinder.cs |
Adds unsigned option conversion for reflection binding. |
CoAP.NET/Option.cs |
Adds unsigned access and typed integer-width validation. |
CoAP.NET/Message.cs |
Adds unsigned size properties and unsigned Max-Age reading. |
CHANGELOG.md |
Summarizes behavior changes, compatibility, and validation limits. |
Review effort: Balanced
Member
Author
|
Delivery readback for this batch:
The checked-in HANDOFF/audit files record the pre-push candidate snapshot. This comment is the subsequent CI/merge/issue/worktree readback. |
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.
Large Size1/Size2 values could be read as negative numbers or truncated, and legal Observe Max-Age values could overflow the re-registration timer. This change preserves the complete UInt32 option range through typed APIs, Resource/MVC binding and blockwise assembly, and schedules Observe refreshes from a monotonic deadline with one bounded timer.
Automatic request tokens now use RandomNumberGenerator.GetBytes(8). Explicit tokens and existing retransmission, Block1/Block2 and Observe identities are retained. Actual DTLS session/traffic-key identity is not available in the channel/exchange contract, so RFC 9175 secure-context non-reuse remains UNKNOWN; #33 and its umbrella #23 stay open.
Compatibility: existing signed Size1/Size2/IntValue APIs and signatures retain their four-byte bit patterns. New callers can use UIntValue and Size1Unsigned/Size2Unsigned. Overlong raw typed values now throw OverflowException. Size estimates remain metadata; they do not control allocation or replace the Block M bit.
Validation on Windows Release with TreatWarningsAsErrors=true:
Original failing reproductions, exact commands and source hashes are recorded in docs/audits/coap-20261113/next-batch-validation.json and next-batch-execution.json. The first COAPALL failure exposed an old fixture using a string for integer Content-Format; it now uses MediaType.TextPlain. Independent review also corrected the host fixture to use request Size2=0 as RFC 7959 requires.
The pinned libcoap v4.3.5 / Californium 3.13.0 UDP/DTLS matrix is NOT_RUN: peer commands and images are unavailable in the checked environment. #26 stays open. NativeAOT execution, package publication and device/field qualification remain separate and NOT_RUN. No tag, NuGet publication or deployment is part of this PR.
Closes #34
Closes #35
Refs #23, #26, #33