You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(oscore): address open review items from PR #397
- server: hoist _oscoreOnly out of the oscoreContexts gate so the flag
is honoured when contexts are added at runtime via addOscoreContext()
- agent: drop unsolicited plaintext datagrams in oscoreOnly mode for
peers that have no registered context (defense in depth)
- middlewares: drop the (oscore as any).clearRebootRecovery() cast; the
method is publicly typed in coap-oscore ≥ 2.2.1
- middlewares: wrap parseOscoreOption() in try/catch so malformed OSCORE
options surface as 4.01 Unauthorized rather than bubbling through the
middleware chain as a 5.00
- oscore_helpers: reject reserved high flag bits (0xe0) and PIV lengths
6 and 7 per RFC 8613 §6.1
- oscore: give _pendingEchoNonces entries a 30s TTL so peers that never
reply to an Echo challenge can't accumulate in the map; matched
storePendingEcho/clearPendingEcho/getPendingEcho accessors accordingly
- helpers: introduce ECHO_OPTION constant (RFC 9175 option 252) and use
it everywhere instead of the magic string '252'
- agent: switch import crypto = require('crypto') to ESM-style import
for consistency with the rest of the codebase
- README: collapse the two-require server example into a single require
from 'coap' (OscoreContextStatus is re-exported)
- package.json: revert version bump to 1.4.2 (matches master), bump
coap-oscore floor to ^2.2.2 (latest published)
Adds 4 new tests covering the changes above:
- oscoreOnly applied via addOscoreContext() at runtime
- oscoreOnly agent silently drops unsolicited inbound plaintext
- malformed OSCORE option (reserved PIV length) → 4.01
- pending Echo nonce evicted after TTL
All 24 OSCORE tests pass; 492 in the wider suite (IPv6 tests excluded —
broken in sandbox, unaffected by these changes).
0 commit comments