Skip to content

fix: require a secure origin for direct GitHub App setup - #272

Merged
moe-berri merged 1 commit into
mainfrom
litellm_github_app_secure_cookie
Nov 29, 2026
Merged

moe-berri merged 1 commit into
mainfrom
litellm_github_app_secure_cookie

Conversation

@moe-berri

@moe-berri moe-berri commented Nov 29, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Direct GitHub App mode accepted any public_url, so a non-loopback HTTP origin made Lens issue and expire the OAuth state cookie without Secure. Remote and hosted service modes already reject that at startup. GitHubSettings::new now applies the same remote::secure_origin check to the direct App's public_url

if github.is_some_and(|g| !secure_origin(&g.public_url))
    || ((remote.is_some() || service_enabled) && !secure_origin(&public_url))
{
    return Err(Configuration("LENS_PUBLIC_URL must use HTTPS (HTTP localhost is supported for development)"));
}

HTTPS 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 cookie

The new parametrized test covers the origin policy, and the existing OAuth flow tests now assert Secure on the issued cookie and Secure plus Max-Age=0 on the expiry cookie. Removing the guard fails the origin test. cargo fmt, cargo clippy -D warnings and all 797 server tests pass

CodeQL's rust/insecure-cookie query will probably still flag github.rs because 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 call

Details

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_url is not a secure origin, matching the policy already applied to remote and hosted service modes via remote::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 the Secure flag.

A new parametrized test covers allowed and rejected origins; OAuth flow tests use HTTPS fixtures and assert Secure on 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.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@devin-ai-integration

Copy link
Copy Markdown
Contributor

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

@moe-berri

Copy link
Copy Markdown
Collaborator Author

bugbot run

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ 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.

@moe-berri
moe-berri merged commit 46c51ec into main Nov 29, 2026
12 checks passed
@moe-berri
moe-berri deleted the litellm_github_app_secure_cookie branch November 29, 2026 00:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant