Skip to content

fix(security): validate and pin transcript request destinations - #125

Open
DoRmAmMu1997 wants to merge 1 commit into
mainfrom
codex/scanner-security-egress
Open

DoRmAmMu1997 wants to merge 1 commit into
mainfrom
codex/scanner-security-egress

Conversation

@DoRmAmMu1997

Copy link
Copy Markdown
Owner

Transcript downloads previously followed redirects before checking the final destination. This change validates every hop before requesting it and connects to a validated public IP while retaining the original Host header, TLS SNI, and certificate hostname.

The transport refuses private/mixed DNS answers, malformed or looping redirects, more than three hops, ambient proxies/netrc settings, and unsupported legacy Session injection. Redirect bodies are not eagerly consumed; successful PDFs retain streamed size, content-type, and magic-byte checks. Trusted offline resolver/transport hooks support tests. The default application caller uses the hardened owned transport.

Direct urllib3 usage is declared and pinned to the already-tested 2.7.0 version. The ADR and component docs explain the destination boundary and compatibility change.

Validation:

  • Full Python 3.12 suite: 2,073 passed, 1 skipped; 89.78% coverage including app.py.
  • Final focused PDF/URL suite: 96 passed after test-fixture typing fixes.
  • Independent review: 59 focused tests passed on each of Python 3.11 and 3.12; no actionable security findings in this package.
  • Full mypy: 261 files clean; Ruff, compileall, Bandit, pip-audit and diff checks passed.
  • Hosted Python 3.11/3.12, Docker and CodeQL will verify the published head.

PDF parser process containment is a separate work package. This PR changes the HTTP/download boundary only.

Co-authored by Codex.

Validate each redirect before fetching and pin the socket destination while
preserving original TLS identity. Bound redirect traversal and avoid eager
redirect-body reads. Document and test the fail-closed transport contract.

Co-authored-by: Codex <codex@openai.com>
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