fix(auth): require HTTPS login instructions - #552
Open
sylvesterkaczmarek wants to merge 2 commits into
Open
Conversation
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
Reject external plaintext HTTP authentication URLs when extracting interactive Codex login instructions.
Fixes #550.
Reproduction / evidence
Current upstream
mainat37bf87a692fc72d41f7312cc48808d699d204fbasearches login output with anhttps?://pattern and then validates only hostname locality. A fake login child that prints:causes current
mainto retain the first external URL,http://auth.example.test/insecure, asverificationUrl.The existing authentication boundary already filters local HTTP listener/callback URLs and retains remote HTTPS verification URLs.
Root cause
preferredAuthUrl()parsed candidate URLs and checked whether their hostname was localhost, loopback, or unspecified, but never checked the parsed protocol. Because the initial matcher accepts bothhttpandhttps, any external plaintext HTTP URL survived.Fix
Parse each candidate once and require
parsed.protocol === "https:"before applying the existing hostname exclusions. Local HTTP listener lines continue to be ignored, and a later HTTPS verification URL can still be selected.Tests / validation
Added
auth-http-url.test.ts, which launches a real child process that emits an external HTTP URL before an HTTPS URL plus a device code. The test requires the handle to expose only the HTTPS URL and preserve the code.The branch is based directly on current upstream
mainat37bf87a692fc72d41f7312cc48808d699d204fbaand is not behind it. Production change: 3 additions and 1 deletion.Full repository tests cannot be run in this execution environment because the repository cannot be cloned here. Pushed-head CI remains the authoritative full-suite validation.
Risk
Low. The change narrows accepted remote authentication destinations to HTTPS while preserving the existing local-address filtering and terminal parsing behavior.