Fix input validation DoS and in-flight timer recovery#11
Merged
Conversation
Security fixes: - All POST handlers: check for missing request body before parsing. Previously (need body.request.req) crashed the agent on empty POST. Now returns redirect (forms) or JSON error (API) gracefully. - from-hex: no longer crashes on invalid hex chars (was !!). Added from-hex-safe that returns (unit @) for user-facing endpoints. Invalid hex in signature, ciphertext, ephemeral pubkey, or MAC fields now returns an error instead of crashing. - require-body/require-json-body helpers for safe body extraction. Bug fix: - In-flight token timers re-armed on agent restart. Previously, ship restart lost all Behn timers, leaving in-flight tokens stranded forever. on-load now schedules recovery timers for any existing in-flight entries.
e3eeb1a to
acb479f
Compare
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.
Summary
Three security/reliability fixes from final review:
(need body.request.req)which crashes on missing body. Now usesrequire-body/require-json-bodyhelpers that return error responses.from-hexused!!on non-hex chars. Addedfrom-hex-safereturning(unit @)for all user-facing endpoints (signature, ciphertext, ephemeral pubkey, MAC).on-loadnow re-arms recovery timers for existing in-flight entries.Test plan
"signature":"ZZZZ"returns error, not crash