Open
Conversation
…che clear on logout, annotationsState scoping)
…learing is unnecessary churn
Contributor
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.
Gate 4.2 — Token/localStorage hardening ✅
Full audit of all
localStorageusage across the interfaces repo, with three targeted fixes implemented on branch402-token-localstorage-hardening-review.Threat surface documented:
userTokenapi/TPEN.jscheckExpired(). Primary mitigations applied below.vault:*js/vault.jstpen-drafts:{project}:{page}components/transcription-blockannotationsStateinterfaces/manage-columnsChanges in this PR:
Token expiration UX (
api/TPEN.jsconstructor) — previously expiry only added a.expiredCSS class with no user notification. Now dispatches atpen-toasterror and callsTPEN.login()after 4 s, ensuring users are always redirected to log in again.TPEN.getAuthorization()in TPEN 2.8 import flow (components/new-action.js) — replaced rawlocalStorage.getItem("userToken")withTPEN.getAuthorization(), which runs the expiry check before use. If the token is expired the handler redirects to login rather than proceeding with a stale token.annotationsStatekey scoped with project ID (interfaces/manage-columns/index.js) — all five read/write/remove calls now use`annotationsState:${TPEN.screen.projectInQuery ?? 'unknown'}`to prevent any cross-project state bleed.Residual risks noted for threat model (require TPEN3/services coordination):
localStorage(vs.HttpOnlycookie) — this is an architectural decision owned by the TPEN3 auth flow; mitigated here by expiry enforcement and expiration UX redirect.