Skip to content

fix: guard public tool URL fetches - #129

Open
Melvynx wants to merge 1 commit into
mainfrom
security/saveit-public-tools-ssrf-2026-06-20
Open

fix: guard public tool URL fetches#129
Melvynx wants to merge 1 commit into
mainfrom
security/saveit-public-tools-ssrf-2026-06-20

Conversation

@Melvynx

@Melvynx Melvynx commented Jun 20, 2026

Copy link
Copy Markdown
Owner

Summary

  • Adds a centralized safeToolFetch guard for public URL-fetching tools
  • Rejects local/private/link-local/metadata IPv4 and IPv6 targets, localhost variants, and unsafe DNS resolutions
  • Revalidates every redirect hop, applies request timeout, and caps response size
  • Routes extract metadata/content/OG/favicon fetches through the guard

Security proof

  • Original proof: /root/.hermes/workspaces/documents/security-audits/2026-06-19/all-repos/saveit/proof-output.json
  • Fixed proof: /root/.hermes/workspaces/documents/security-audits/2026-06-19/all-repos/saveit/public-tools-ssrf-fixed.out.json

Verification

  • git diff --check passed
  • Added apps/web/__tests__/safe-fetch.test.ts
  • pnpm vitest run __tests__/safe-fetch.test.ts, dependency install, and Node-based proof execution could not run on this VPS because Node/WebAssembly allocation OOMed before tests started

No production network or customer data was touched.

@vercel

vercel Bot commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
saveit-now-web Ready Ready Preview, Comment Jun 20, 2026 12:27pm

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b8fa6edb97

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

redirectCount += 1
) {
const timeoutSignal = AbortSignal.timeout(timeoutMs);
const response = await fetch(currentUrl.href, {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Pin the vetted address when fetching

When a user supplies an attacker-controlled hostname, validatePublicToolUrl resolves and approves one set of DNS answers, but this fetch(currentUrl.href, ...) performs a separate hostname resolution for the actual connection. A DNS rebinding or split-horizon change between the check and the request can make validation see a public IP while the request connects to 127.0.0.1 or 169.254.169.254, bypassing the SSRF guard; the fetch needs to use the already-vetted IP or a custom lookup/agent tied to that validation result.

Useful? React with 👍 / 👎.

@Melvynx
Melvynx force-pushed the security/saveit-public-tools-ssrf-2026-06-20 branch from b8fa6ed to c284475 Compare June 20, 2026 12:25
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