fix(web): clear revealed credential on edit and auto-hide after 30s#291
fix(web): clear revealed credential on edit and auto-hide after 30s#291devin-ai-integration[bot] wants to merge 1 commit into
Conversation
After editing a credential, the stale plaintext remained visible in the table until manually hidden. Now the revealed value is cleared from state when the edit modal saves, so the row returns to masked dots immediately. Additionally, revealed values now auto-hide after 30 seconds of inactivity to reduce accidental exposure. Co-Authored-By: jake <jake@infisical.com>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
|
| Filename | Overview |
|---|---|
| web/src/pages/vault/CredentialsTab.tsx | Adds auto-hide timer (30s) for revealed credentials and clears revealed values on save; timer cleanup is missing in the onSaved path, causing a spurious state update after the timeout fires. |
Reviews (1): Last reviewed commit: "fix(web): clear revealed credential on e..." | Re-trigger Greptile
| onSaved={() => { | ||
| // Clear revealed value for the edited credential so stale plaintext | ||
| // is never shown after a value change. | ||
| if (editingKey) { | ||
| setRevealedValues((prev) => { | ||
| const next = { ...prev }; | ||
| delete next[editingKey]; | ||
| return next; | ||
| }); | ||
| } |
There was a problem hiding this comment.
The
onSaved callback clears the revealed value but does not cancel the corresponding auto-hide timer. If a credential was revealed at t=0 and then saved at t=10s, the timer started by scheduleAutoHide will still fire at t=30s and call setRevealedValues unnecessarily — creating a new object via {...prev} and triggering a React re-render even though the key is already gone. The fix mirrors what the manual-hide branch already does: cancel the timer before clearing the state.
| onSaved={() => { | |
| // Clear revealed value for the edited credential so stale plaintext | |
| // is never shown after a value change. | |
| if (editingKey) { | |
| setRevealedValues((prev) => { | |
| const next = { ...prev }; | |
| delete next[editingKey]; | |
| return next; | |
| }); | |
| } | |
| onSaved={() => { | |
| // Clear revealed value for the edited credential so stale plaintext | |
| // is never shown after a value change. | |
| if (editingKey) { | |
| if (revealTimers.current[editingKey]) { | |
| clearTimeout(revealTimers.current[editingKey]); | |
| delete revealTimers.current[editingKey]; | |
| } | |
| setRevealedValues((prev) => { | |
| const next = { ...prev }; | |
| delete next[editingKey]; | |
| return next; | |
| }); | |
| } |
Summary
Fixes two UX issues with credential reveal in the Credentials tab:
Stale value after edit: When a credential was revealed and then edited, the old plaintext remained visible until manually hidden. Now
revealedValues[key]is cleared in theonSavedcallback so the row immediately returns to masked dots.Indefinite visibility: Revealed values previously stayed visible until manually hidden or page navigation. Now each reveal starts a 30-second auto-hide timer — the value fades back to
••••••••automatically. Manually hiding cancels the timer; re-revealing resets it.Type of change
Test plan
npx tsc --noEmitpasses)Verified:
Security checklist
Link to Devin session: https://app.devin.ai/sessions/946ef78afe184a9fab689ee139cddd69