Fix user-visible mirror URL leaks#7
Open
hqhq1025 wants to merge 1 commit into
Open
Conversation
b4581ac to
dd14164
Compare
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
Fixes user-visible URL realism issues across WebHarbor mirror sites while preserving benchmark runtime localhost entry points.
Fixed surfaces:
http://localhost:40008/place/<slug>.https://example.com/<slug>placeholders, with runtime fallback for existing packaged DB rows.request.urlmirror URLs into hiddennextinputs.nextredirects now only allow root-relative paths.window.location.href; it copies the articlesource_urlor a BBC fallback URL.http://localhost:40006; it stays on the current host with a relative redirect.docs/url-realism-audit.mddocumenting the issue classes, intentional localhost/example.com matches, root causes, and regression rule.scripts/check_url_realism.pyfor the known user-visible URL leak classes.Root Cause
The mirrors mixed two URL roles:
tasks.jsonland docs; andSeveral templates and middleware reused local request URLs directly (
request.url,window.location.href, or fixed localhost redirects), causing local mirror addresses to leak into UI or copied links.Verification
python3 scripts/check_url_realism.pypython3 -m py_compile sites/allrecipes/app.py sites/booking/app.py sites/bbc_news/app.py sites/github/app.py sites/google_map/app.py sites/google_map/seed_data.py scripts/check_url_realism.pynextvalues and rejects absolute next redirects.nextvalues and rejects absolute next redirects.window.location.hrefor localhost.Host: github.comredirects to/microsoft/vscode?tab=readme, nothttp://localhost:40006/..../place/galleria-vittorio-emanuelerendershttps://www.google.com/maps/place/Galleria+Vittorio+Emanuele+II+Milan/and does not leaklocalhost:40008orexample.com/galleria-vittorio-emanuele.Fixes #13.