Repository navigation
fix: validate DEVIN_API_URL and disallow redirects on authenticated requests - #11
Merged
TheOnlyFusionCube merged 1 commit intoOct 23, 2026
Conversation
DEVIN_API_URL was used verbatim as the destination for bearer-authenticated create/get/message calls, so a malicious or mistyped value could send the API key to an arbitrary host, and redirects were followed. Add resolveApiOrigin: unset or exactly https://api.devin.ai only. Userinfo, paths, queries, fragments, other ports, and other hosts are rejected before any fetch. Loopback http(s) is allowed only with the explicit test opt-in DEVIN_COMPANION_ALLOW_LOOPBACK_API=1. apiRequest now uses redirect "error" and treats 3xx as an error. setup reports a rejected URL instead of crashing, and handoff fails before creating a job.
TheOnlyFusionCube
approved these changes
Oct 23, 2026
TheOnlyFusionCube
left a comment
Owner
There was a problem hiding this comment.
Verified test suite (44 passed across 58 origin/redirect assertions). Clean implementation of Proposal 7.
This was referenced Oct 23, 2026
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.
Proposal 7 in #4.
What was wrong
cloud.mjssent bearer-authenticated create/get/message calls toDEVIN_API_URLexactly as given. A malicious or mistyped value could send the API key to any host, or to a URL carrying credentials or a path.What changed
resolveApiOrigin(env):https://api.devin.ai.http, whitespace or control characters, and look-alike or IDN tricks. Error messages never echo the raw URL.DEVIN_COMPANION_ALLOW_LOOPBACK_API=1, forhttp(s)on127.0.0.1,[::1]orlocalhost, on any port.getCloudConfigno longer throws. It returnsapiUrl: nullandapiUrlError.resolveApiBaseandapiRequestboth refuse to build or send a request when that error is set.apiRequestusesredirect: "error"and treats any 3xx as an error./devin:setupreports a rejected URL instead of crashing, and/devin:handofffails before it creates a job.How tested
tests/cloud-url.test.mjs, 16 tests, all against a mockedglobalThis.fetch:setupandhandoffbehave correctly through the CLI.node --test: 44 pass, 0 fail.