fix(pages): security hardening: only serve to our origin - #22156
Conversation
db3d7f3 to
27c07d3
Compare
27c07d3 to
890b880
Compare
mikehardy
left a comment
There was a problem hiding this comment.
Local CI-parity on a rebase onto current main: jacocoUnitTestReport failed (twice, including after :AnkiDroid:clean) with:
PrefsSearchBarTest → Could not resolve fragment for xml/preferences_review_reminders
Investigation notes:
- This PR only touches pages/WebView hardening (no preferences changes)
- GitHub unit CI is green
- Isolated PrefsSearchBarTest passes; full suite fails
- Same local failure pattern as #22141 on this host
- Root suspicion:
HeaderFragment.configureSearchBarindexesR.xml.preferences_review_reminderswhenPrefs.newReviewRemindersEnabled, butgetFragmentFromXmlReshas no branch for that XML — so if any earlier test leaves the flag enabled, this assertion fails (suite-order pollution)
Holding Approve/enqueue until local full unit is green (or the prefs mapping / test isolation is fixed). Lint + emulator local lanes were green.
890b880 to
2d9c8b0
Compare
|
Snapshot diff report: Previous regressions were resolved by the latest commit. |
|
Flake has been split off; requesting re-review
Define 'isInternalUrl' for future use Part of 21926 Assisted-by: GPT-6
Serve bundled assets only for URLs on the configured local-server origin. Part of 21926 Assisted-by: GPT-6
These WebViews have an exception and are able to access our backend. If we load an untrusted page, it would retain this backend access, probably fine unless we're specifically targeted, but not worth the risk. The manual is fine (via Deck Options), so trust it. Part of 21926. Assisted-by: GPT-6
2d9c8b0 to
bbf80e5
Compare
mikehardy
left a comment
There was a problem hiding this comment.
Hey David 👋
LGTM — origin-locked asset serving and fail-closed external navigation match the hardening slice for #21926, and the PageWebViewClient / DeckOptions tests lock that in.
Local lint / unit / package / emulator are green on a rebase onto current main (full unit suite; PrefsSearchBar suite-order red is gone after #22209). Happy to merge.
Note
Assisted-by: GPT-6 - proposed and implemented while updating the backend, I cleaned it up
Purpose / Description
Ensure that pages such as 'Deck Options' cannot be used to load external web pages which can then load internal
ankiassets from the backend, or call into Anki APIsFixes
Approach
isInternalUrldocs.ankiwebHow Has This Been Tested?
Tests added
Checklist