Fix validated Codex Security findings - #283
Conversation
MohammadHaroonAbuomar
left a comment
There was a problem hiding this comment.
Verdict: request-changes. One blocking SSRF gap in the new IP canonicalization (inline); the rest is correct.
Implemented correctly and covered by tests:
- Credential leak: the tester transcript event reuses the sanitized
build_llm_call_traceoutput;sanitize_payloadredactsapi_key, andtest_transcript_redacts_tester_request_credentialsasserts the token is absent from the serialized transcript. - Content-filter handling:
LLMContentFilterErroris caught as a scoped per-case error and counted inerrored_countinstead of aborting the coordinator. Theseed_row.get("seed_id")it replaces was a latent NameError — the sibling handlers already usetest_case_row. - Redirect / DNS-rebinding hardening:
allow_redirects=Falsewith explicit 3xx rejection, connection-time revalidation via_ValidatingResolver, and connector/resolver cleanup on partial init, each with a regression test.
CI is green (CodeQL, Tier 1 unit tests, install matrix). Local tests/test_security.py: 58 passed.
Blocking finding: the connection-IP validator canonicalizes embedded IPv4 only for IPv4-mapped addresses and treats other IPv4-in-IPv6 embeddings as global unicast. NAT64 (64:ff9b::/96) and IPv4-compatible (::/96) forms pass validation while embedding private / loopback / metadata IPv4, giving a working SSRF bypass on a NAT64 network. Details and fix inline in assert_ai/core/security.py.
MohammadHaroonAbuomar
left a comment
There was a problem hiding this comment.
Approved. The IPv4-in-IPv6 SSRF gap from the previous review is closed and verified against ab4ee6b.
_canonicalize_endpoint_ip now resolves the embedded IPv4 for IPv4-mapped (::ffff:), NAT64 well-known prefix (64:ff9b::/96), and IPv4-compatible (::/96, excluding :: and ::1) addresses before the range and is_global checks. Re-probed on this head:
64:ff9b::7f00:1,64:ff9b::a9fe:a9fe(metadata),64:ff9b::a83f:8110(Azure wireserver), and::127.0.0.1are all rejected.- NAT64/mapped/compatible forms that embed a public IPv4 (
64:ff9b::5db8:d822,::ffff:93.184.216.34) are still allowed, so the canonicalization does not over-block. ::and::1remain IPv6 and are caught by the blocked ranges / is_global check.
Rejection and allow tests were added for each case; tests/test_security.py passes (65). CI is green (15/15). The credential-leak, content-filter, redirect, and DNS-rebinding fixes from the first pass are unchanged. No outstanding items.
Summary
Security validation
A complete Codex Security run at xhigh effort covered all 98 scoped files. The reported high-severity credential leak and two medium-severity findings were reproduced safely and confirmed before these fixes were implemented. Review follow-up also closed IPv4-in-IPv6 SSRF bypasses for the RFC 6052 NAT64 well-known prefix and deprecated IPv4-compatible addresses.
Tests
python -m pytest -q: 1193 passed, 23 skipped, 474 subtests passednpm run checkinviewer: 0 errors (6 existing warnings)