fix: block stale OAuth exchange in local-only mode

This commit is contained in:
faber
2026-07-14 10:59:04 -04:00
parent f1851326b9
commit 45e40b57bb

View File

@@ -4718,6 +4718,14 @@ RESPOND WITH EXACTLY ONE LINE. No explanation, no preamble.`;
const cleanUrl = window.location.origin + window.location.pathname;
window.history.replaceState({}, '', cleanUrl);
// A stale OAuth callback must never re-enable a cloud request while
// strict local-only mode is active.
if (state.localOnly) {
sessionStorage.removeItem('or_code_verifier');
sessionStorage.removeItem('or_callback_url');
return false;
}
const codeVerifier = sessionStorage.getItem('or_code_verifier');
if (!codeVerifier) {
console.warn('[OAuth] Got code but no verifier in session — stale callback?');