fix: add vault sentinel to prevent passphrase bypass on empty credential vault#848
Conversation
Added vault sentinel for passphrase verification during credential unlocking. Enhanced security by implementing a fallback strategy for legacy vaults.
🚀 Thank You for Contributing to Late-MeetPlease ensure that:
Thank you for contributing 💙 |
|
Warning Review limit reached
More reviews will be available in 59 minutes and 16 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits. 🚦 How do rate limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthrough
ChangesVault sentinel verification
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
👋 Thank you @711nishtha for your contribution to Late-Meet! ✅ Verified: You are assigned to the linked issue #837. Please review any automated suggestions or code review comments that may appear below! We will review your PR as soon as possible! Please consider starring the repository ⭐ to show your support! |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/utils/credentials.test.ts`:
- Around line 201-284: The test declarations in credentials.test.ts are using
escaped quote delimiters, which breaks TypeScript parsing and prevents the test
file from loading. Update the affected test() calls in the credentials
regression section to use normal string quotes, and keep the rest of the
assertions and helper usage unchanged so the suite can compile and run.
In `@src/utils/credentials.ts`:
- Around line 179-188: The credential verification flow in the
encrypted-credentials branch is incorrectly skipping malformed values like
"enc:" because the sample lookup in credentials.ts only checks truthy entries.
Update the verification logic around the encryptedCreds/CREDENTIAL_KEYS path so
legacy encrypted entries are still validated even when the ciphertext payload is
empty or malformed, and ensure a decryption attempt (or explicit failure)
happens before any sentinel write or true return. Focus on the sampleKey
selection and the crypto.subtle.decrypt path in the credential verification
routine.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 90b825d5-e195-4d11-88cf-3630e5f36a3a
📒 Files selected for processing (2)
src/utils/credentials.test.tssrc/utils/credentials.ts
Refactor credential verification to ensure a valid key is present before decryption. Improve comments for clarity on handling empty/malformed ciphertexts.
|
|
@shouri123 suggestions have been addressed. The PR is ready for review and merge. Thank You. |



Problem
unlockCredentials()verified the passphrase by decrypting a sampleAPI credential. When the vault had been initialized (salt stored) but
no credentials saved yet, the verification block was skipped and any
passphrase was accepted as valid.
A user who mistyped their passphrase on this "empty window" would
silently encrypt their subsequent API keys with the wrong-passphrase-
derived key, making them unrecoverable with the correct passphrase.
Fix
Writes an encrypted vault sentinel (
late-meet-vault-v1) tochrome.storage.localon every first-time vault setup. All subsequentunlockCredentials()calls verify the passphrase by decrypting thesentinel — no API credentials needed for verification.
Backward compatible: existing vaults without a sentinel fall back to
credential-based verification and write the sentinel for migration.
Files changed
src/utils/credentials.ts— sentinel constants + revisedunlockCredentials()src/utils/credentials.test.ts— 4 regression testsCloses #837
Summary by CodeRabbit