Skip to content

Harden JSON handling and add client safety controls - #4

Merged
scott-malyon merged 1 commit into
mainfrom
codex/client-hardening
Oct 14, 2026
Merged

scott-malyon merged 1 commit into
mainfrom
codex/client-hardening

Conversation

@scott-malyon

Copy link
Copy Markdown
Contributor

Summary

Bound successful JSON reads and give applications explicit control over HTTP logging and storage destinations. Keep file streaming, credential isolation and no-retry behavior intact.

JSON response -> check encoding -> bounded read -> parse -> close
Storage request -> optional destination policy -> send once
HTTP logs -> opt-in handler filter -> application output
  • Add configurable JSON limits: 64 KiB for OAuth, 8 MiB for API/discovery. Reject unexpected compression and preserve uncertain outcomes for mutations and token exchanges.
  • Export HTTPLogFilter for explicit installation on application output handlers; add optional destination_policy callbacks for download redirects and direct uploads.
  • Reject invalid access-token characters early and accept callback DNS hostname case differences while retaining strict OAuth target, state and issuer checks.
  • Verify signed upload conditions are preserved and HTTP 412 is returned without retry; document configuration, backend-dependent ETags and direct-download revocation behavior.

Evidence

  • Before: successful JSON reads had no configurable body ceiling; applications had no SDK-provided HTTP-log filter or storage-destination hook.
    After: regression tests cover byte limits regardless of declared length, compression rejection before body consumption, response cleanup, uncertain outcomes, filtered logs, every redirect/upload policy decision and OAuth validation.
  • 540 tests pass against the checkout and again against a clean installed wheel from outside the checkout.
  • Ruff lint and formatting pass; source distribution and wheel build successfully, including wheel construction from the sdist.
  • Installed-wheel smoke test and dependency checks pass. Tests use synthetic data and mock HTTP; no live server compatibility claim.

Merge Danger

Door: two-way. No migration or persistent state change; revert restores the previous client behavior.

Blast Radius: clients.

Successful JSON exceeding the default limit or using unexpected compression now raises ProtocolError; callers can configure the size limit. Logging suppression and destination restrictions are opt-in. Private storage remains permitted by default. Mutation/token rejection may leave the outcome uncertain and does not trigger a retry.

@scott-malyon
scott-malyon merged commit 8f5f2d6 into main Oct 14, 2026
16 checks passed
@scott-malyon
scott-malyon deleted the codex/client-hardening branch October 14, 2026 14:12
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