Repository navigation
Canonicalise local browser origin for Google OAuth - #322
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR ensures local Von UI navigation uses a single, Google OAuth-compatible browser origin by canonicalising 127.0.0.1 entry requests to the configured localhost origin (same port), preventing OAuth redirect URI mismatches during local development.
Changes:
- Add a Flask
before_requesthook that redirects only UI entry GET/HEAD requests from127.0.0.1:<port>tohttp://localhost:<port>, preserving path/query and settingCache-Control: no-store. - Introduce
build_browser_entry_url()and update the direct Python launcher to openlocalhostwhen binding to127.0.0.1. - Add focused pytest coverage for redirect/canonicalisation behaviour and launcher URL building.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| tests/backend/test_local_browser_origin_canonicalisation.py | Adds test coverage for local origin canonicalisation rules and app-factory installation. |
| src/workflows/von/main.py | Updates browser auto-open URL to use the canonicalised entry URL helper. |
| src/backend/server/utils_flask.py | Implements local browser origin canonicalisation middleware and the entry URL builder. |
Comment on lines
+2262
to
+2266
| "/", | ||
| "/von", | ||
| "/von/", | ||
| "/von/workflow-studio", | ||
| } |
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.
What changed
127.0.0.1to the explicitly configuredlocalhostGoogle OAuth origin on the same port.no-store.localhostwhen Flask binds to127.0.0.1.Why
Google OAuth requires the supplied redirect URI to match the registered URI exactly. Von's local callbacks are configured for
localhost, while direct startup could open the UI on127.0.0.1; those are different browser origins and break the OAuth popup/session path.Validation
git diff --checkpassed.302to the exactlocalhostpath/query while/healthand auth-status remain200on127.0.0.1.http://localhost:5099/...and renders the canonical page.