Skip to content

๐Ÿ›ก๏ธ Sentinel: [MEDIUM] ์›นํ›… URL ์ƒ์„ฑ ์‹œ SSRF ์ทจ์•ฝ์  ์ˆ˜์ • - #612

Closed
seonghobae wants to merge 1 commit into
developfrom
sentinel-webhook-ssrf-9438641368313520909
Closed

๐Ÿ›ก๏ธ Sentinel: [MEDIUM] ์›นํ›… URL ์ƒ์„ฑ ์‹œ SSRF ์ทจ์•ฝ์  ์ˆ˜์ •#612
seonghobae wants to merge 1 commit into
developfrom
sentinel-webhook-ssrf-9438641368313520909

Conversation

@seonghobae

@seonghobae seonghobae commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

๐Ÿšจ Severity: MEDIUM

๐Ÿ’ก Vulnerability: The application allows users to configure a webhook URL via /api/orgs/:id/webhooks. Previously, it did not check if the provided URL pointed to internal IP addresses or cloud metadata services. Since sendWebhook blindly issues a fetch request to that URL, an attacker could use this endpoint to perform a Server-Side Request Forgery (SSRF) attack.

๐ŸŽฏ Impact: An attacker could probe internal networks, access cloud metadata services (e.g., 169.254.169.254), or interact with internal APIs running on the server or localhost.

๐Ÿ”ง Fix: Added validation in the POST /api/orgs/:id/webhooks endpoint to parse the provided URL and explicitly reject localhost, 127.0.0.1, ::1, 169.254.169.254, and 0.0.0.0. Updated the smoke tests to use example.com instead of 127.0.0.1 to accommodate this new restriction.

โœ… Verification: Run npm run test:api to verify the tests still pass and the smoke test completes successfully. Attempting to add http://localhost/hook via the API should now return a 400 Bad Request.


PR created automatically by Jules for task 9438641368313520909 started by @seonghobae


Open in Devin Review

@google-labs-jules

Copy link
Copy Markdown

๐Ÿ‘‹ Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a ๐Ÿ‘€ emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@coderabbitai

coderabbitai Bot commented Aug 26, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 58 minutes.

View limit details

Limit details: Youโ€™ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

โš™๏ธ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: b7e3447c-7043-4bef-a5bd-7df09beba92f

๐Ÿ“ฅ Commits

Reviewing files that changed from the base of the PR and between 2c32887 and 8b68b4c.

๐Ÿ“’ Files selected for processing (3)
  • .jules/sentinel.md
  • server/app.mjs
  • tests/api/smoke.mjs

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

โค๏ธ Share

Comment @coderabbitai help to get the list of available commands.

@devin-ai-integration devin-ai-integration 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.

Devin Review found 2 potential issues.

Open in Devin Review

Comment thread tests/api/smoke.mjs

// ---- Webhooks ----
r = await req(`/api/orgs/${orgAId}/webhooks`, { method: 'POST', headers: auth, body: body({ url: 'http://127.0.0.1:9/hook', events: ['project.update'] }) });
r = await req(`/api/orgs/${orgAId}/webhooks`, { method: 'POST', headers: auth, body: body({ url: 'http://example.com/hook', events: ['project.update'] }) });

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

๐ŸŸก Webhook test now depends on external network

The webhook test posts to http://example.com/hook instead of a port that refuses instantly, so the failure-and-retry assertions now depend on an outside host. If outbound traffic is dropped, the fetch stalls until the 3s abort, past the 900ms wait, and the attempt-2 retry is never recorded, failing the test. If the host answers 2xx, no retry is scheduled and the assertions fail too.

Prompt for agents
The webhook delivery assertions at tests/api/smoke.mjs:289-296 require the delivery to fail (ok===0) and be retried to attempt 2 within a 900ms wait. Previously the test used http://127.0.0.1:9/hook, which produces an instant, deterministic connection refusal on the loopback interface. The SSRF fix in POST /api/orgs/:id/webhooks now blocks 127.0.0.1, so the test was switched to http://example.com/hook. This makes the failure/retry assertions depend on outbound internet reachability, on example.com returning a non-2xx status, and on the response arriving fast enough that the retry (scheduled 500ms after the first failure) lands inside the 900ms window. In a sandboxed CI environment that drops outbound packets, the fetch will hang until the 3s AbortController timeout in sendWebhook, so the first delivery is not recorded until ~3s and no attempt-2 row exists at 900ms. Consider using a URL that is guaranteed to fail fast yet is not on the SSRF blocklist โ€” e.g. a reserved TEST-NET address like http://192.0.2.1:9/hook (RFC 5737, unroutable, fast to fail) or a .invalid domain like http://nonexistent.invalid/hook that fails DNS instantly โ€” so the test stays deterministic and offline-safe.
Open in Devin Review

Was this helpful? React with ๐Ÿ‘ or ๐Ÿ‘Ž to provide feedback.

Comment thread server/app.mjs
Comment on lines +752 to +760
try {
const parsedUrl = new URL(url);
const hostname = parsedUrl.hostname.toLowerCase();
if (['localhost', '127.0.0.1', '::1', '169.254.169.254', '0.0.0.0'].includes(hostname)) {
return c.json({ error: 'internal webhook destinations are not allowed' }, 400);
}
} catch {
return c.json({ error: 'valid http(s) url required' }, 400);
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

๐ŸŸจ Webhook SSRF denylist is incomplete and bypassable

The check rejects only five literal hostnames. It misses private ranges (10/8, 172.16/12, 192.168/16), the rest of loopback and link-local, IPv6 internal ranges, and alternate IP encodings (decimal, octal, hex). Because only the submitted hostname is checked, a public DNS name resolving to an internal IP, or a public host that redirects inward, still reaches internal targetsโ€”fetch in sendWebhook follows redirects unvalidated (server/app.mjs:106).

Open in Devin Review

Was this helpful? React with ๐Ÿ‘ or ๐Ÿ‘Ž to provide feedback.

Copy link
Copy Markdown
Contributor Author

Closing path: this PR is not a safe SSRF repair and is superseded by the existing #551 owner lane, PR #588 (fix/webhook-ssrf-551-develop@6d18ecc6e46fba63fe21623a4a5608493ef305fd).

Fresh exact-head review of #612 at 8b68b4cf2a0f950710a82b77d0740821b46c9a02 confirms two material regressions:

  1. The five-host literal denylist is bypassable by ordinary private/special-use IPv4/IPv6 ranges, alternate numeric forms, DNS rebinding, and redirects. The delivery path still follows destination authority not bound to a freshly authorized address.
  2. Replacing the deterministic loopback refusal fixture with http://example.com/hook makes the smoke test depend on external network timing/behavior and can miss its 900 ms retry window.

#588 already owns the causal boundary with public-HTTPS registration, IPv4/IPv6 special-use rejection, A/AAAA validation, per-attempt DNS re-resolution, validated-address socket pinning, TLS hostname preservation, redirect refusal, bounded transport behavior, legacy-row handling, and offline-realistic regressions. Its exact source includes a dedicated server/webhook_transport.mjs policy/transport boundary rather than a registration-time hostname blocklist.

There is no unique buyer/security behavior in #612 worth preserving: .jules/sentinel.md recommends the weaker denylist design, server/app.mjs implements that incomplete design, and the smoke edit weakens determinism. Do not merge or restack #612; continue the comprehensive #588/#551 repair path and regenerate exact-head evidence there after the repository/central CI provenance controls are repaired.

@google-labs-jules

Copy link
Copy Markdown

Closing path: this PR is not a safe SSRF repair and is superseded by the existing #551 owner lane, PR #588 (fix/webhook-ssrf-551-develop@6d18ecc6e46fba63fe21623a4a5608493ef305fd).

Fresh exact-head review of #612 at 8b68b4cf2a0f950710a82b77d0740821b46c9a02 confirms two material regressions:

  1. The five-host literal denylist is bypassable by ordinary private/special-use IPv4/IPv6 ranges, alternate numeric forms, DNS rebinding, and redirects. The delivery path still follows destination authority not bound to a freshly authorized address.
  2. Replacing the deterministic loopback refusal fixture with http://example.com/hook makes the smoke test depend on external network timing/behavior and can miss its 900 ms retry window.

#588 already owns the causal boundary with public-HTTPS registration, IPv4/IPv6 special-use rejection, A/AAAA validation, per-attempt DNS re-resolution, validated-address socket pinning, TLS hostname preservation, redirect refusal, bounded transport behavior, legacy-row handling, and offline-realistic regressions. Its exact source includes a dedicated server/webhook_transport.mjs policy/transport boundary rather than a registration-time hostname blocklist.

There is no unique buyer/security behavior in #612 worth preserving: .jules/sentinel.md recommends the weaker denylist design, server/app.mjs implements that incomplete design, and the smoke edit weakens determinism. Do not merge or restack #612; continue the comprehensive #588/#551 repair path and regenerate exact-head evidence there after the repository/central CI provenance controls are repaired.

Understood. Acknowledging that this work is now obsolete and superseded by PR #588, and stopping work on this task.

@seonghobae seonghobae closed this Aug 26, 2026
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