Repository navigation
fix: require a secure origin for direct GitHub App setup - #272
Merged
Merged
Conversation
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Contributor
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
Collaborator
Author
|
bugbot run |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 2efc569. Configure here.
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
Direct GitHub App mode accepted any
public_url, so a non-loopback HTTP origin made Lens issue and expire the OAuth state cookie withoutSecure. Remote and hosted service modes already reject that at startup.GitHubSettings::newnow applies the sameremote::secure_origincheck to the direct App'spublic_urlHTTPS and HTTP loopback (
localhost,127.0.0.1,[::1]) still start. A direct App configured on plain HTTP for a non-loopback host now fails at startup instead of running with a weaker cookieThe new parametrized test covers the origin policy, and the existing OAuth flow tests now assert
Secureon the issued cookie andSecureplusMax-Age=0on the expiry cookie. Removing the guard fails the origin test.cargo fmt,cargo clippy -D warningsand all 797 server tests passCodeQL's
rust/insecure-cookiequery will probably still flaggithub.rsbecause the.secure(...)argument is still conditional and the query does not see the startup check. This PR fixes the runtime behavior. The scanner alerts stay open for a dismissal callDetails
Link to Devin session: https://app.devin.ai/sessions/604e2d9bb69b49aaac631fc849351aaf
Open in Devin Desktop: https://app.devin.ai/desktop/session/604e2d9bb69b49aaac631fc849351aaf?variant=devin
Requested by: @moekhalil
Note
Low Risk
Startup-only configuration guard on GitHub OAuth; no change to runtime auth logic beyond rejecting unsafe direct-app URLs.
Overview
Direct GitHub App setup now fails at startup when the app’s
public_urlis not a secure origin, matching the policy already applied to remote and hosted service modes viaremote::secure_origin(HTTPS or HTTP on loopback only). Plain HTTP on a non-loopback host no longer starts and can no longer yield OAuth state cookies without theSecureflag.A new parametrized test covers allowed and rejected origins; OAuth flow tests use HTTPS fixtures and assert
Secureon issued and cleared state cookies.Reviewed by Cursor Bugbot for commit 2efc569. Bugbot is set up for automated code reviews on this repo. Configure here.