Skip to content

Hardening pass around reliability, validation, and secure/error handling - #17

Merged
ostefani merged 13 commits into
mainfrom
refactor/code-review
Nov 8, 2026
Merged

ostefani merged 13 commits into
mainfrom
refactor/code-review

Conversation

@ostefani

@ostefani ostefani commented Nov 8, 2026 •

Copy link
Copy Markdown
Owner
  • Hardened outbound HTTP and ScanRelay transport failure handling, including timeout/cancel/refused/TLS cases and sanitizing diagnostics so external peer text is not exposed.
  • Added stricter replay-response validation for forwarded events, rejecting oversized or malformed conflict responses and preserving delivery state correctly.
  • Tightened startup sequencing and dependency checks before replay/purge operations, ensuring required services and config are initialized in the right order.
  • Strengthened model JSON decoding and repair logic to reject malformed, trailing, unknown-field, and missing-value responses with stable, typed errors.
  • Improved the provider/model validation path, including invalid citations, evidence refs, and repair boundary diagnostics.
  • Isolated and pinned config validation rules and positive/negative test coverage so intended rejection reasons are explicit and regression-safe.
  • Updated documentation/README formatting and flag documentation to reflect the clarified validation and operational behavior.
  • Added/expanded tests covering forwarding failures, hostile payloads, loopback behavior, invalid model outputs, and persistence/repair edge cases.

Initialize the server and provider before recovery, replay, and purge.
Test that a missing model key file prevents forwarding and purge.
Read one extra byte on conflicts to detect truncated replay evidence.
Test that an oversized conflict leaves delivery pending and a valid retry succeeds.
Classify transport failures and record numeric HTTP statuses.
Test logs, stored receipts, and webhook responses with hostile text.
Share safe transport diagnostics between proxy forwarding and annotation
publishing. Replace publisher request construction errors with a fixed
message.

Test diagnostic categories, publisher log containment, HTTP client
timeouts, and receipt persistence after sweep cancellation.
- share transport classification across ScanRelay and model clients,
including deadline errors wrapped through multiple layers.
- test refused and untrusted TLS connections, provider error privacy,
and publisher status handling and cancellation.
- require a complete JSON value in provider envelopes, briefings, and
incident summaries while keeping rejection messages free of model text.
- pin transport diagnostic wording, handle sandboxed loopback tests, and
correct the duplicate waiter documentation.
- require EOF after one model value and preserve safe rejection messages.
- cover evidence references, citations, and malformed suffixes. Exercise
host envelope validation in the ingest fuzz target and handle unavailable
loopback addresses in the transport tests.
- fuzz complete model responses against Go's JSON validity check and
cover empty inputs, type mismatches, nested unknown fields, and null.
- preserve typed destination errors and pin repair diagnostics.
Return typed destination errors before parsing and preserve them through
briefing and summary parsers. Test invalid destinations with malformed
input and pin decoded values for the documented JSON behavior.
Correct the unknown-field fixture and pin briefing rejection messages.
Compare strict decoding with encoding/json in the fuzz target and
clarify the decoder contract.
Cover malformed summaries, missing required fields, and invalid
citations and evidence references. Pin the existing briefing
diagnostic for a field type mismatch.
Pin nested model errors at the repair boundary, isolate config
validation rules, and verify signed envelope rejection and non-persistence.
Pin the intended rejection for each config case and add positive
controls for the isolated rules. Cover evidence and citation errors
at the parent repair boundary.

The prior handler-above-Pro fixture duplicated the write-timeout
rejection, since the earlier checks already bound the handler.
@ostefani ostefani changed the title Refactor/code review Hardening pass around reliability, validation, and secure/error handling Nov 8, 2026
@ostefani
ostefani merged commit 0badb29 into main Nov 8, 2026
6 checks passed
@ostefani
ostefani deleted the refactor/code-review branch November 8, 2026 07:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant