chore(memory): R4.12 gates recorded, RUST.md §10.14 router note from the security gate, journal, learning

This commit is contained in:
bchanot committed 2026-10-21 19:04:14 +02:00
1 parent e6fbed5e12
commit 17f6a17809
4 files changed
+15 -7

No files matched your search

+8 -6
View File
@@ -2452,12 +2452,14 @@ tab inside `..` into `//evil.test`: same origin for the sentinel, yet a
protocol-relative path once returned. The rebuilt value is now refused when
it starts with `//` or no longer resolves to the sentinel origin, so the
function's contract holds by itself. Consumers (`LoginRoute`,
`RedirectIfSignedIn`, `AuthCallbackRoute`) were not exposed in practice:
react-router 7.18.4's `useNavigate` throws « External navigation is not
allowed » on such a target and `<Navigate>` collapses the slashes
(`resolvePath('//evil.test/app/account')` = `/evil.test/app/account`, a
not-found page), read in the installed package; the fix does not rely on
it. Tests: 4 new `safeNextPath` cases (12 dot-segment spellings, external
`RedirectIfSignedIn`, `AuthCallbackRoute`): with react-router 7.18.4,
`useNavigate` checks the target (« External navigation is not allowed »)
and `<Navigate>` collapses the slashes (`resolvePath('//evil.test/app/account')`
= `/evil.test/app/account`), and the old function made the LoginRoute test
fail without leaving the origin. The security gate read one more path in
the installed package: `history.push` falls back to `window.location.assign`
when `pushState` throws. So the router's guards are not a contract this
code may lean on, and the fix does not rely on them. Tests: 4 new `safeNextPath` cases (12 dot-segment spellings, external
schemes and escapes, encoded slashes kept literal and legitimate paths
unchanged, idempotence) and a `LoginRoute` case through the real router
(`next=/..//evil.test/app/account` lands on the dashboard); on the old