Skip to content

fix(security): sanitize CWE-209 response errors - #1725

Open
groupthinking with Copilot wants to merge 3 commits into
mainfrom
copilot/claudedetermined-maxwell-7xje6x
Open

groupthinking with Copilot wants to merge 3 commits into
mainfrom
copilot/claudedetermined-maxwell-7xje6x

Conversation

Copilot AI commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Canonical issue

Outcome

Prevents exception diagnostics from reaching HTTP clients through generated endpoints, persisted response trees, and 5xx response constructors while retaining server-side logs.

Scope

  • Included:
    • Static client-safe errors for generated, cloud, real API, and adapter paths.
    • Recursive sanitization of persisted error, error_message, and errors response fields.
    • AST guard coverage for 500–599 statuses, positional JSONResponse bodies, and src/uvai/ml.
  • Explicitly excluded:
    • Workflow, dependency, and deployment changes.
except Exception:
    logger.exception("Generated endpoint failed")
    raise HTTPException(status_code=500, detail="Internal server error")

Risk

  • Risk level: low
  • Failure mode: Clients receive stable generic error text instead of provider diagnostics.
  • Rollback: Revert b22dda0.

Verification

Current head: b22dda0

  • Focused tests — 221 passed
  • Required CI
  • Review threads resolved

Production evidence

Not applicable: changes affect Python backend paths; Vercel preview builds apps/web.

Agent handoff

  • One canonical issue is linked
  • No competing PR implements the same issue
  • Acceptance criteria are satisfied
  • Required checks pass on the current head
  • Human decision is requested only for product, security, irreversible infrastructure, or production approval

@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 15, 2026 6:26am UTC

Co-authored-by: groupthinking <154503486+groupthinking@users.noreply.github.com>
Copilot AI changed the title [WIP] Remove CWE-209 response-body leaks for security fix(security): sanitize CWE-209 response errors Sep 8, 2026
Copilot AI requested a review from groupthinking September 8, 2026 22:58
# round-trip, which would otherwise re-serialise the payload on
# the event loop in proportion to its size.
return Response(content=video_data, media_type="application/json")
return Response(

@vercel vercel Bot Sep 8, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The CWE-209 response sanitization (JSON parse + recursive tree-walk + re-serialize) runs synchronously on the asyncio event loop in get_video_analysis and get_processed_videos_list, reintroducing the exact size-proportional loop stall the surrounding worker-thread offload was designed to prevent.

Fix on Vercel

@groupthinking
groupthinking marked this pull request as ready for review September 12, 2026 08:19
@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: 2d5d0d75-5c8f-469c-be88-9e82eec2c5ba

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.

@github-actions

github-actions Bot commented Sep 12, 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 b0cd34e.
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

@groupthinking
groupthinking enabled auto-merge (squash) September 12, 2026 10:27
@groupthinking groupthinking added the bug Something isn't working label Sep 12, 2026
@cursor

cursor Bot commented Sep 12, 2026

Copy link
Copy Markdown
Contributor

Backlog triage: leaving open. CWE-209 sanitize (#912) is CONFLICTING vs rewritten main. Kept as the single rebase target after closing #1690.

@groupthinking

Copy link
Copy Markdown
Owner

@copilot resolve the merge conflicts on this branch.

…ned-maxwell-7xje6x

# Conflicts:
#	src/agents/specialized/code_generator.py
#	src/youtube_extension/backend/cloud_api_endpoints.py

Co-authored-by: groupthinking <154503486+groupthinking@users.noreply.github.com>
auto-merge was automatically disabled September 15, 2026 06:25

Head branch was pushed to by a user without write access

Copilot AI commented Sep 15, 2026

Copy link
Copy Markdown
Contributor Author

@copilot resolve the merge conflicts on this branch.

Resolved by merge commit b0cd34e1, preserving both the CWE-209 hardening and current-main callback protections. Focused CWE-209 tests: 257 passed.

@github-actions

Copy link
Copy Markdown
Contributor

✅ E2E Test Results: ALL TESTS PASSED

Metric Value
Status 🟢 GREEN
Total Tests
Passed 17
Failed
Deployment https://v0-uvai-etn82kji1-garv1.vercel.app
Test Output
tdout�[2m | tests/e2e/pipeline.test.ts�[2m > �[22m�[2mEventRelay E2E — Live Deployment�[2m > �[22m�[2mSSE Pipeline Stream�[2m > �[22m�[2mSSE stream emits at least a pipeline_status:running event
�[22m�[39m[E2E] last pipeline_status: complete

 �[32m✓�[39m 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�[33m 19748�[2mms�[22m�[39m
 �[32m✓�[39m tests/e2e/pipeline.test.ts�[2m > �[22mEventRelay E2E — Live Deployment�[2m > �[22mSSE Pipeline Stream�[2m > �[22mSSE stream closes within 90 seconds (no 95% hang)�[33m 17136�[2mms�[22m�[39m
 �[32m✓�[39m tests/e2e/pipeline.test.ts�[2m > �[22mEventRelay E2E — Live Deployment�[2m > �[22mSSE Pipeline Stream�[2m > �[22mSSE events fire in correct agent order�[33m 19100�[2mms�[22m�[39m
 �[32m✓�[39m tests/e2e/pipeline.test.ts�[2m > �[22mEventRelay E2E — Live Deployment�[2m > �[22mCloudEvent Schema�[2m > �[22mSSE events contain valid timestamps�[33m 19909�[2mms�[22m�[39m
 �[32m✓�[39m tests/e2e/pipeline.test.ts�[2m > �[22mEventRelay E2E — Live Deployment�[2m > �[22mCloudEvent Schema�[2m > �[22mterminal pipeline_status includes duration and stage progress�[33m 21801�[2mms�[22m�[39m
 �[32m✓�[39m tests/e2e/pipeline.test.ts�[2m > �[22mEventRelay E2E — Live Deployment�[2m > �[22mError Handling�[2m > �[22mmissing URL returns 400, not a hang�[32m 176�[2mms�[22m�[39m
 �[32m✓�[39m tests/e2e/pipeline.test.ts�[2m > �[22mEventRelay E2E — Live Deployment�[2m > �[22mError Handling�[2m > �[22minvalid URL returns error event or completes quickly, not a hang�[33m 4915�[2mms�[22m�[39m
 �[32m✓�[39m tests/e2e/pipeline.test.ts�[2m > �[22mEventRelay E2E — Live Deployment�[2m > �[22mDashboard�[2m > �[22m/dashboard returns 200�[32m 292�[2mms�[22m�[39m
 �[32m✓�[39m tests/e2e/pipeline.test.ts�[2m > �[22mEventRelay E2E — Live Deployment�[2m > �[22mDashboard�[2m > �[22m/dashboard contains agent or pipeline visualization markup�[32m 105�[2mms�[22m�[39m
 �[32m✓�[39m tests/e2e/pipeline.test.ts�[2m > �[22mEventRelay E2E — Live Deployment�[2m > �[22mAPI Health�[2m > �[22mGET /api returns a response (not 404)�[33m 360�[2mms�[22m�[39m
 �[32m✓�[39m tests/e2e/pipeline.test.ts�[2m > �[22mEventRelay E2E — Live Deployment�[2m > �[22mAPI Health�[2m > �[22mPOST /api/pipeline/stream with no body returns 400�[32m 175�[2mms�[22m�[39m
 �[32m✓�[39m tests/e2e/pipeline.test.ts�[2m > �[22mEventRelay E2E — Live Deployment�[2m > �[22mStatic Assets�[2m > �[22mhomepage has proper meta tags�[32m 95�[2mms�[22m�[39m
 �[32m✓�[39m tests/e2e/pipeline.test.ts�[2m > �[22mEventRelay E2E — Live Deployment�[2m > �[22mStatic Assets�[2m > �[22m/features page returns 200�[32m 98�[2mms�[22m�[39m

�[2m Test Files �[22m �[1m�[32m1 passed�[39m�[22m�[90m (1)�[39m
�[2m      Tests �[22m �[1m�[32m17 passed�[39m�[22m�[90m (17)�[39m
�[2m   Start at �[22m 06:27:14
�[2m   Duration �[22m 107.08s�[2m (transform 59ms, setup 0ms, import 75ms, tests 106.84s, environment 0ms)�[22m


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

Labels

bug Something isn't working python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Execution: remove CWE-209 response-body leaks (PR #831)

2 participants