fix(security): prevent SSRF in task-automation enterprise API calls (CodeQL #116) - #3411
Merged
Merged
Conversation
Fixes CodeQL js/request-forgery (alert #116, critical). callEnterpriseApi builds `new URL(endpoint, enterpriseApiUrl)` then fetches it; getAutomationRunStatus interpolated a user-provided runId straight into the endpoint path (`/api/tasks-automations/runs/${runId}`), so a crafted runId could inject path segments into the request URL. - Encode the user value in the path (encodeURIComponent(runId)). - Add an origin allowlist guard in callEnterpriseApi: resolve the URL against the configured enterprise API base and reject anything whose origin differs, so no caller can redirect the request to another host. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
claudfuen
pushed a commit
that referenced
this pull request
Jul 15, 2026
# [3.102.0](v3.101.2...v3.102.0) (2026-07-15) ### Bug Fixes * **ci:** pin Syft 1.46.0 in SBOM action (1.42.3 can't parse bun.lock) ([#3415](#3415)) ([5f47024](5f47024)) * **ci:** scan bun.lock via file: input so the SBOM isn't empty ([#3414](#3414)) ([e47e6fd](e47e6fd)) * **deps:** override uuid to ^11.1.1 (Dependabot [#85](#85)) ([#3418](#3418)) ([598ff8c](598ff8c)) * **deps:** patch tmp and js-yaml in mcp-server (Dependabot [#58](https://github.com/trycompai/comp/issues/58)/[#59](https://github.com/trycompai/comp/issues/59)/[#71](https://github.com/trycompai/comp/issues/71)) ([#3412](#3412)) ([59a6b0f](59a6b0f)) * **deps:** remediate dependency security vulnerabilities ([#3403](#3403)) ([7577a37](7577a37)) * **deps:** remediate dependency security vulnerabilities (165→16, 4 critical→0) ([#3406](#3406)) ([d403e9c](d403e9c)) * **device-agent:** implement the installer-cleanup fix ([#3381](#3381)) ([0f7581b](0f7581b)) * **security:** prevent SSRF in task-automation enterprise API calls ([#3411](#3411)) ([dcec288](dcec288)), closes [#116](#116) * **security:** resolve open CodeQL alerts (XSS, sanitization, workflow perms) ([#3419](#3419)) ([32329be](32329be)), closes [#108](#108) [js/xss-throu#dom](https://github.com/js/xss-throu/issues/dom) [#95](#95) [84/#85](#85) ### Features * **framework-editor:** raise requirement description limit to 100,000 chars (FRAME-2) ([67c9f4a](67c9f4a))
Contributor
|
🎉 This PR is included in version 3.102.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes CodeQL
js/request-forgery(alert #116, critical) — a server-side request forgery in the task-automation server actions.callEnterpriseApi()buildsnew URL(endpoint, enterpriseApiUrl)andfetches it.getAutomationRunStatus()interpolated a user-providedrunIddirectly into the endpoint path (/api/tasks-automations/runs/${runId}) with no encoding, so a craftedrunIdcould inject extra path segments into the outgoing request URL. (The other callers pass user data viasearchParams.appendor the POST body, which don't influence the request target.)Fix
Two layers:
encodeURIComponent(runId)so it can only ever be a single, inert path segment.callEnterpriseApi) — resolve the URL against the configured enterprise API base and reject anything whoseorigindiffers from it. This pins every request to the trusted host regardless of caller, so no user-derived value can redirect a request elsewhere.Notes / verification
runIdvalues (trigger.dev run ids) are unaffected byencodeURIComponent.@trycompai/apptypecheck: the changed file compiles clean (the only typecheck failures are pre-existing test-file debt onmain, unrelated to this change).Closes the code-scanning alert once CodeQL re-runs on this branch.
🤖 Generated with Claude Code
Summary by cubic
Prevents SSRF in task-automation enterprise API requests by pinning requests to the configured origin and encoding user input in URL paths. Fixes CodeQL js/request-forgery alert #116 without changing valid behavior.
callEnterpriseApi: resolve against base URL and reject endpoints whoseorigindiffers.runIdingetAutomationRunStatuswithencodeURIComponentto prevent path injection.Written for commit 8be58dc. Summary will update on new commits.