Skip to content

fix: close the remaining audit findings across the gateway - #17

Merged
dinhdev666 merged 1 commit into
mainfrom
fix/close-the-remaining-audit-findings
Dec 4, 2026
Merged

dinhdev666 merged 1 commit into
mainfrom
fix/close-the-remaining-audit-findings

Conversation

@dinhdev666

Copy link
Copy Markdown
Owner

fix: close the remaining audit findings across the gateway

Round four of the audit. Every item below has a regression test that
fails without its fix.

Correctness:

  • filter the consolidated text_end through the turn's tool bridge,
    so the [[OPENCODE_TOOL_CALL]] envelope no longer reaches
    content next to the parsed tool_calls on any surface;
  • adopt a consolidated reasoning_end on streamed
    /v1/chat/completions, which was the only surface without it;
  • close the orchestrator generator on every early return of the
    /v1/responses stream, so a failed turn cannot leave a sticky
    session busy: true;
  • reject max_tool_calls, prompt_cache_key and
    safety_identifier on /v1/responses instead of stripping them;
  • treat null as unset for the optional Anthropic fields, matching
    the OpenAI surfaces;
  • drop the unreachable duplicate best_of / suffix rejections on
    /v1/completions.

Media:

  • prove a local attachment is a regular file before open(), so a
    FIFO can no longer block the libuv threadpool;
  • measure the base64 bound on the payload without its line
    wrapping;
  • release the count slot when byte admission fails;
  • stop an empty file_data from shadowing a valid file_url;
  • map ENXIO / ENODEV to invalid_attachment.

Upstream:

  • carry the log redaction across chunk boundaries, so a split
    server password marker cannot reach the log file in plaintext;
  • cancel unread response bodies on the 401, probe and event-stream
    failure paths;
  • release the log descriptor and the live-child entry when a spawn
    fails;
  • stop counting a deliberate stop() as a start failure;
  • clamp the reconnect delay and reset it in stop();
  • enforce the session entry cap when the store is loaded;
  • drop the instance from the process-exit registry;
  • truncate the retained upstream error body;
  • hash the tool set once per turn and reuse the memoised root
    message JSON in deriveKey.

HTTP, auth and configuration:

  • charge /metrics to the api bucket and add a global failed-auth
    ceiling behind a shared proxy address;
  • accept only the documented Basic form and compare fixed-width
    digests without short-circuiting;
  • reject a trustProxy CIDR prefix of 0;
  • warn on an invalid boolean, reasoning default or log level;
  • match the Anthropic surface path exactly and append to vary;
  • memoise the per-request path and presented key.

Docs follow the behaviour change; docs/VERIFICATION.md no longer
claims a query-string key is a transport.

Round four of the audit. Every item below has a regression test that
fails without its fix.

Correctness:
- filter the consolidated `text_end` through the turn's tool bridge,
  so the `[[OPENCODE_TOOL_CALL]]` envelope no longer reaches
  `content` next to the parsed `tool_calls` on any surface;
- adopt a consolidated `reasoning_end` on streamed
  `/v1/chat/completions`, which was the only surface without it;
- close the orchestrator generator on every early return of the
  `/v1/responses` stream, so a failed turn cannot leave a sticky
  session `busy: true`;
- reject `max_tool_calls`, `prompt_cache_key` and
  `safety_identifier` on `/v1/responses` instead of stripping them;
- treat `null` as unset for the optional Anthropic fields, matching
  the OpenAI surfaces;
- drop the unreachable duplicate `best_of` / `suffix` rejections on
  `/v1/completions`.

Media:
- prove a local attachment is a regular file before `open()`, so a
  FIFO can no longer block the libuv threadpool;
- measure the base64 bound on the payload without its line
  wrapping;
- release the count slot when byte admission fails;
- stop an empty `file_data` from shadowing a valid `file_url`;
- map `ENXIO` / `ENODEV` to `invalid_attachment`.

Upstream:
- carry the log redaction across chunk boundaries, so a split
  `server password` marker cannot reach the log file in plaintext;
- cancel unread response bodies on the 401, probe and event-stream
  failure paths;
- release the log descriptor and the live-child entry when a spawn
  fails;
- stop counting a deliberate `stop()` as a start failure;
- clamp the reconnect delay and reset it in `stop()`;
- enforce the session entry cap when the store is loaded;
- drop the instance from the process-exit registry;
- truncate the retained upstream error body;
- hash the tool set once per turn and reuse the memoised root
  message JSON in `deriveKey`.

HTTP, auth and configuration:
- charge `/metrics` to the api bucket and add a global failed-auth
  ceiling behind a shared proxy address;
- accept only the documented Basic form and compare fixed-width
  digests without short-circuiting;
- reject a `trustProxy` CIDR prefix of `0`;
- warn on an invalid boolean, reasoning default or log level;
- match the Anthropic surface path exactly and append to `vary`;
- memoise the per-request path and presented key.

Docs follow the behaviour change; `docs/VERIFICATION.md` no longer
claims a query-string key is a transport.
@dinhdev666
dinhdev666 merged commit b8d6941 into main Dec 4, 2026
5 checks passed
@dinhdev666
dinhdev666 deleted the fix/close-the-remaining-audit-findings branch December 4, 2026 17:21
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