Skip to content

fix(security): SSRF-safe cloud callbacks with pinned DNS and log sanitization - #1686

Merged
groupthinking merged 3 commits into
mainfrom
execution-harden-cloud-callback-ssrf-and-log-grv-93-186b
Sep 12, 2026
Merged

groupthinking merged 3 commits into
mainfrom
execution-harden-cloud-callback-ssrf-and-log-grv-93-186b

Conversation

@linear-code

@linear-code linear-code Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Recreates the PR #734 cloud-callback hardening on a fresh branch cut from current main, so the change carries clean provenance (the original PR is blocked only by its historical pre-dispatch boundary, not by code issues).

Changes to src/youtube_extension/backend/cloud_api_endpoints.py (+ tests in tests/unit/test_cloud_routes.py):

  • Resolve the callback host once, off the event loop; reject malformed URLs and any non-global destination (private, loopback, link-local, CGNAT, IPv6 site-local), failing closed on mixed public/private DNS answers.
  • Pin connections to the validated numeric addresses while preserving Host header, port, TLS SNI, hostname certificate verification, disabled redirects, and async I/O — closing the DNS-rebinding window.
  • Bound dispatch to at most three resolved addresses under a single deadline, and never retry a POST that may already have been transmitted.
  • CR/LF-sanitize untrusted callback values and exception values before logging; client-facing 500 details stay static.

The PR #734 diff was applied onto current main with a 3-way merge; the intervening #1361 change (Cloud Tasks auth before payload validation) is preserved alongside the hardening. Note: the session was cut off before the focused suite (tests/unit/test_cloud_routes.py) could run in this environment — please rely on CI for verification. The same diff passed CI, Coverage, CodeQL, Security/Secret scans, Dependency Review, and CodeRabbit review at PR #734's head (122 focused tests passed there).

…tization

Recreate the PR #734 hardening on a fresh main-based branch: resolve
callback hosts once off-loop, reject non-global/mixed DNS answers, pin
connections to validated numeric addresses (preserving Host/SNI/hostname
verification and disabled redirects), bound dispatch to three addresses
under one deadline without retrying a transmitted POST, and CR/LF-sanitize
untrusted callback and exception log values.

Generated with [Linear](https://linear.app/myxstack/agent-session/f979788e-1a9c-463c-8f45-146d3c1ec52e)

Co-authored-by: linear-code[bot] <222613912+linear-code[bot]@users.noreply.github.com>
@linear-code

linear-code Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor Author

GRV-93

@vercel

vercel Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

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

Project Deployment Actions Updated
v0-uvai Ready Ready Preview, v0 Sep 12, 2026 10:36am UTC

@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

🔍 PR Validation

✅ Current validation passed.

@github-actions github-actions Bot added the python label Sep 8, 2026
@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Snapshot Warnings

⚠️: No snapshots were found for the head SHA 6ae822d.
Ensure that dependencies are being submitted on PR branches. Re-running this action after a short time may resolve the issue. See the documentation for more information and troubleshooting advice.

Scanned Files

None

Comment thread src/youtube_extension/backend/cloud_api_endpoints.py Fixed
Comment thread src/youtube_extension/backend/cloud_api_endpoints.py Fixed
@groupthinking groupthinking added high-priority Urgent - blocks revenue or core functionality agent-task mcp/agent labels Sep 8, 2026
@groupthinking
groupthinking marked this pull request as ready for review September 12, 2026 10:34
@groupthinking
groupthinking self-requested a review as a code owner September 12, 2026 10:34
@coderabbitai

coderabbitai Bot commented Sep 12, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 09851baa-ecd5-4ada-b1c4-e21e2c32d2ac

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

groupthinking
groupthinking previously approved these changes Sep 12, 2026
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@groupthinking
groupthinking merged commit 0c1a4dd into main Sep 12, 2026
18 of 23 checks passed
@groupthinking
groupthinking deleted the execution-harden-cloud-callback-ssrf-and-log-grv-93-186b branch September 12, 2026 10:35
@github-actions

Copy link
Copy Markdown
Contributor

🔴 E2E Test Results: FAILURE DETECTED

Metric Value
Status 🔴 RED
Total Tests 6
Passed 11
Failed 6
Deployment https://v0-uvai-5mdqlpfbk-garv1.vercel.app
Test Output
2m''�[39m�[33m;�[39m
    �[90m190|�[39m       �[34mexpect�[39m(ct)�[33m.�[39m�[34mtoContain�[39m(�[32m'text/event-stream'�[39m)�[33m;�[39m

�[31m�[2m⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[3/6]⎯�[22m�[39m

�[41m�[1m FAIL �[22m�[49m tests/e2e/pipeline.test.ts�[2m > �[22mEventRelay E2E — Live Deployment�[2m > �[22mSSE Pipeline Stream�[2m > �[22mSSE stream emits at least a pipeline_status:running event
�[31m�[1mAssertionError�[22m: expected 0 to be greater than or equal to 1�[39m
�[36m �[2m❯�[22m tests/e2e/pipeline.test.ts:�[2m208:29�[22m�[39m
    �[90m206|�[39m
    �[90m207|�[39m       �[90m// Must have at least 1 event�[39m
    �[90m208|�[39m       �[34mexpect�[39m(events�[33m.�[39mlength)�[33m.�[39m�[34mtoBeGreaterThanOrEqual�[39m(�[34m1�[39m)�[33m;�[39m
    �[90m   |�[39m                             �[31m^�[39m
    �[90m209|�[39m
    �[90m210|�[39m       �[90m// Must start with pipeline_status:running�[39m

�[31m�[2m⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[4/6]⎯�[22m�[39m

�[41m�[1m FAIL �[22m�[49m tests/e2e/pipeline.test.ts�[2m > �[22mEventRelay E2E — Live Deployment�[2m > �[22mError Handling�[2m > �[22mmissing URL returns 400, not a hang
�[31m�[1mAssertionError�[22m: expected 401 to be 400 // Object.is equality�[39m

�[32m- Expected�[39m
�[31m+ Received�[39m

�[32m- 400�[39m
�[31m+ 401�[39m

�[36m �[2m❯�[22m tests/e2e/pipeline.test.ts:�[2m358:26�[22m�[39m
    �[90m356|�[39m
    �[90m357|�[39m       �[35mconst�[39m elapsed �[33m=�[39m �[33mDate�[39m�[33m.�[39m�[34mnow�[39m() �[33m-�[39m start�[33m;�[39m
    �[90m358|�[39m       �[34mexpect�[39m(res�[33m.�[39mstatus)�[33m.�[39m�[34mtoBe�[39m(�[34m400�[39m)�[33m;�[39m
    �[90m   |�[39m                          �[31m^�[39m
    �[90m359|�[39m       �[34mexpect�[39m(elapsed)�[33m.�[39m�[34mtoBeLessThan�[39m(�[34m5_000�[39m)�[33m;�[39m �[90m// Should respond instantly�[39m
    �[90m360|�[39m     })�[33m;�[39m

�[31m�[2m⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[5/6]⎯�[22m�[39m

�[41m�[1m FAIL �[22m�[49m tests/e2e/pipeline.test.ts�[2m > �[22mEventRelay E2E — Live Deployment�[2m > �[22mAPI Health�[2m > �[22mPOST /api/pipeline/stream with no body returns 400
�[31m�[1mAssertionError�[22m: expected [ 400, 500 ] to include 200�[39m
�[36m �[2m❯�[22m tests/e2e/pipeline.test.ts:�[2m441:26�[22m�[39m
    �[90m439|�[39m       )�[33m;�[39m
    �[90m440|�[39m       �[90m// Should handle gracefully — 400 or 500, but respond quickly�[39m
    �[90m441|�[39m       �[34mexpect�[39m([�[34m400�[39m�[33m,�[39m �[34m500�[39m])�[33m.�[39m�[34mtoContain�[39m(res�[33m.�[39mstatus)�[33m;�[39m
    �[90m   |�[39m                          �[31m^�[39m
    �[90m442|�[39m     })�[33m;�[39m
    �[90m443|�[39m   })�[33m;�[39m

�[31m�[2m⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[6/6]⎯�[22m�[39m


�[2m Test Files �[22m �[1m�[31m1 failed�[39m�[22m�[90m (1)�[39m
�[2m      Tests �[22m �[1m�[31m6 failed�[39m�[22m�[2m | �[22m�[1m�[32m11 passed�[39m�[22m�[90m (17)�[39m
�[2m   Start at �[22m 11:46:42
�[2m   Duration �[22m 2.84s�[2m (transform 50ms, setup 0ms, import 64ms, tests 2.65s, environment 0ms)�[22m


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent-task high-priority Urgent - blocks revenue or core functionality mcp/agent python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants