Skip to content

fix(web): block private hosts in S3 endpoint test and save - #1932

Merged
richiemcilroy merged 4 commits into
mainfrom
security/s3-endpoint-ssrf
Oct 23, 2026
Merged

richiemcilroy merged 4 commits into
mainfrom
security/s3-endpoint-ssrf

Conversation

@richiemcilroy

@richiemcilroy richiemcilroy commented Jun 19, 2026 •

Copy link
Copy Markdown
Member

Blocks loopback, private, link-local, reserved, IPv4-compatible (::a.b.c.d), IPv4-mapped (::ffff:, dotted and hex) and NAT64 hosts as S3 endpoints on Cap Cloud, for both the connectivity test (POST /test) and the config save (POST /), to prevent server-side request forgery.

  • The check lives in apps/web/lib/s3-endpoint-policy.ts and uses node:net BlockList, the same approach as the media server URL policy in fix(media-server): check every remote URL against a private-address policy #3000.
  • It runs only when NEXT_PUBLIC_IS_CAP is true in production, so self-hosters can still test and save a localhost or LAN MinIO endpoint. An empty endpoint (default AWS) is never checked.
  • On Cap Cloud the test request's HTTP agents also reject private addresses at connect time, which closes the DNS rebinding window between the check and the request.

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge; no new actionable defect was established.

Summary

This PR checks custom S3 endpoints before testing or saving them on Cap Cloud production.

  • Cap Cloud blocks private S3 endpoints before saving or testing them.

Reviews (4) · Last reviewed commit: "fix(web): block private S3 endpoints on ..." · Reviewed by Greptile

@polarityinc

polarityinc Bot commented Jun 19, 2026

Copy link
Copy Markdown

Paragon Review Skipped

Hi @richiemcilroy! Your Polarity credit balance is insufficient to complete this review.

Please visit https://app.paragon.run to finish your review.

@richiemcilroy

Copy link
Copy Markdown
Member Author

@greptileai please review the PR

@richiemcilroy

Copy link
Copy Markdown
Member Author

@greptileai please review the PR

@vercel

vercel Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

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

Project Deployment Actions Updated
cap-status Ready Ready Preview Oct 23, 2026 10:08pm UTC

@capy-ai capy-ai 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.

Capy found no issues.

View 1 other finding in Capy.

Open in Capy

@richiemcilroy richiemcilroy changed the title fix(web): block private hosts in S3 endpoint test fix(web): block private hosts in S3 endpoint test and save Oct 23, 2026
@richiemcilroy

Copy link
Copy Markdown
Member Author

@greptileai review

@richiemcilroy
richiemcilroy merged commit d098398 into main Oct 23, 2026
39 checks passed
07rjain added a commit to 07rjain/Cap that referenced this pull request Oct 24, 2026
Apply the IPv4-compatible, NAT64 and site-local blocks already used by merged PR CapSoftware#1932. Cover literal endpoint rejection and preserve public IPv4-mapped IPv6 support.

This branch was successfully deployed

2 active deployments
Preview – cap-web — d0f5847b Deployed Oct 23, 2026 by vercel[bot]
Preview – cap-status — d0f5847b Deployed Oct 23, 2026 by vercel[bot]
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