-
Notifications
You must be signed in to change notification settings - Fork 1
Preprod #38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Added a badge on the grade cards to display the subject
- Added more subjects
Grades subject
- Fix initial data sync race causing missing session on startup
- Set React Query persist maxAge to 30 days
- Allow webapp to run under /webapp by setting base path and router basename
- Added a cherry theme
- Added ocean and forest themes - Fixed dark and oled hover color
- Add logs page - Add loaclStorage logging
Data sync race fix, cache persistence, offline fallback, storage logs
Cherry, pride, ocean and forest themes
|
|
||
| function writeStorageLogs(logs: StorageLogEntry[]) { | ||
| try { | ||
| localStorage.setItem(STORAGE_LOGS_KEY, JSON.stringify(logs)); |
Check failure
Code scanning / CodeQL
Clear text storage of sensitive information High
an access to password
This stores sensitive data returned by
an access to password
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 3 days ago
At a high level, the problem stems from persisting the raw password string in localStorage and then including storage operations involving that key in a generic logging mechanism. The correct fix is to avoid storing the password in clear text in localStorage; if a “remember me”–type mechanism is needed, we should instead store a non-sensitive token (for example, a flag or a server-issued opaque token) or at minimum ensure that the logging layer never logs values or fields that may contain passwords.
Given the constraints (we can only touch the shown snippets), the minimal and safest change that preserves intended behavior is:
- Stop persisting the raw password in localStorage.
- Replace the stored
"password"entry with a non-sensitive flag indicating the user chose to persist the session (or remove it entirely if not needed). - Keep the rest of the logging mechanism unchanged so that it only logs metadata about keys and sizes, never the password value.
Concretely:
-
In
src/lib/api/aurion.ts:- Change
setSessionso it no longer callssaveToStorage("password", password). Instead, have it only store the email, and optionally a boolean/string flag such as"sessionPersisted": "true"if you need to track that. - Update
getSessionso it no longer reads"password"from storage. Since we cannot redesign the whole app, the simplest is to havegetSessionreturnnullor a partial session when no in-memory password is available, avoiding long-term persisted credentials. If you want to keep auto-fill behavior, you would need an additional design using a secure token, but that is outside the shown snippets.
- Change
-
In
src/lib/utils/storage.ts:- The main security concern flagged is that tainted data flows into
writeStorageLogsviaappendStorageLog. BecauseStorageLogEntrycurrently does not capture the password value, and the fix in (1) stops storing the password at all, we do not need to modifywriteStorageLogsitself. The logging will continue to log non-sensitive metadata only.
- The main security concern flagged is that tainted data flows into
-
In
src/pages/secondary/login.tsx:handleSubmitcurrently callssetSession(email, password)after a successful login. That will still compile after changingsetSession’s implementation (since we keep the same signature) but will no longer persist the password in localStorage, only the email (and any non-sensitive flags we may store).
With this approach, no new imports or external libraries are needed. The only necessary edits are to setSession and getSession in src/lib/api/aurion.ts; the logging code in storage.ts remains structurally the same, but it will no longer ever be given a log entry that could contain actual password data because we avoid persisting the password.
-
Copy modified lines R11-R12 -
Copy modified lines R16-R17
| @@ -8,13 +8,14 @@ | ||
|
|
||
| export function getSession() { | ||
| const email = getFromStorage("email"); | ||
| const password = getFromStorage("password"); | ||
| return email && password ? { email, password } : null; | ||
| // Do not persist or retrieve the password from storage to avoid clear-text credential storage. | ||
| return email ? { email } : null; | ||
| } | ||
|
|
||
| export function setSession(email: string, password: string) { | ||
| // Only persist non-sensitive session information (email). | ||
| // The password must not be stored in localStorage or any other long-term client-side storage. | ||
| saveToStorage("email", email); | ||
| saveToStorage("password", password); | ||
| } | ||
|
|
||
| export function fetchUser({ |
* Grades subject - Added a badge on the grade cards to display the subject * More subjects - Added more subjects * Data sync race fix - Fix initial data sync race causing missing session on startup * Cache persistence - Set React Query persist maxAge to 30 days * Offline fallback - Allow webapp to run under /webapp by setting base path and router basename * Cherry theme - Added a cherry theme * Pride theme * Ocean and forest themes - Added ocean and forest themes - Fixed dark and oled hover color * Storage logs - Add logs page - Add loaclStorage logging * Change 'Fierté' to 'Rainbow' in en-US.json * Update 'pride' translation to 'Arc-en-ciel' * Update translation for 'pride' in Spanish locale * Update French translation for 'pride' key --------- Co-authored-by: Dark-Louis <louis.solty747@gmail.com> Co-authored-by: Dark-Louis <116973803+Dark-Louis@users.noreply.github.com>
No description provided.