Security: SSRF fail-closed (#38) + pin the execute() permission contract (#39) - #48
Merged
Conversation
…hosts source_url_is_safe() treated a host that resolved to zero IPs as safe — on a host where PHP DNS lookups are disabled but HTTP fetches work, an agent-supplied name that only resolves at fetch time could slip past the internal-address block. It now refuses when nothing resolved; the saddle_source_url_is_safe filter remains the escape hatch for trusted/ NAT'd environments and the returned WP_Error names it. Literal-IP blocks (RFC1918, link-local metadata, loopback) are unchanged. Closes #38 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017iV29qbQ5jCicpuJ8JAtRx
…ck transport The built-in JSON-RPC transport trusts execute() to run the permission_callback before the execute_callback. Verified true on WP 6.9 core (execute() calls check_permissions() first) — now pinned by a test driving a write-tier tool at the read tier: it must return a JSON-RPC error and create nothing. Comment updated from 'verify on first boot' to the verified + test-pinned statement. Closes #39 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017iV29qbQ5jCicpuJ8JAtRx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two independent hardening items from the 2026-07-12 audit.
#38 — SSRF guard fails closed.
source_url_is_safe()treated a host that resolved to zero IPs as safe (fail-open). On hosts where PHP DNS lookups are disabled but HTTP fetches still work, an agent-supplied name that only resolves at fetch time could bypass the internal-address block. Now refuses when nothing resolved; thesaddle_source_url_is_safefilter stays as the trusted-env escape hatch and the WP_Error names it. 7 tests (literal metadata/private/loopback IPs, unresolvable→closed, filter override, public IP passes).#39 — pin the permission contract. The fallback JSON-RPC transport trusts
WP_Ability::execute()to run the permission_callback first — verified true on WP 6.9 core, now pinned by a regression test (write-tier tool at read tier → JSON-RPC error + nothing created). Comment updated from 'verify on first boot'.Suite 309 green (300 base + 9 new). Production PHP is WPCS-clean; tests are out of phpcs scope by config.
Closes #38
Closes #39
🤖 Generated with Claude Code
https://claude.ai/code/session_017iV29qbQ5jCicpuJ8JAtRx