-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Fixed invalid cipher reprompt values #17513
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
base: main
Are you sure you want to change the base?
Conversation
|
Claude finished @gbubemismith's task —— View job Code Review CompleteSummaryThe fix correctly validates the FindingsFinding 1: PR lacks essential information in title, objective, and tracking section Finding 2: Missing test coverage for the new validation logic Finding 3: Inconsistent naming - the fix targets Details💭 Finding 1: PR metadata is incomplete The PR is missing critical information:
Suggested PR description rewrite## 🎟️ Tracking
[Link to Jira ticket]
## 📔 Objective
This PR fixes a bug where invalid reprompt values were being passed to the Rust SDK in the `toSdkCipher` method. The SDK's `CipherRepromptType` only accepts two values: `None` (0) and `Password` (1). However, the TypeScript `Cipher` domain model was passing the raw `reprompt` value without validation, which could potentially include invalid values.
**Changes:**
- Added validation in `toSdkCipher` to ensure only `CipherRepromptType.Password` or `CipherRepromptType.None` are passed to the SDK
- Any value other than `Password` defaults to `None`
## ⏰ Reminders before review
[...]The existing test in Required tests:
Suggested test additionsAdd these test cases to the it("should map reprompt Password value correctly", () => {
const cipher = new Cipher();
cipher.reprompt = CipherRepromptType.Password;
cipher.type = CipherType.Login;
const sdkCipher = cipher.toSdkCipher();
expect(sdkCipher.reprompt).toBe(SdkCipherRepromptType.Password);
});
it("should default invalid reprompt values to None", () => {
const cipher = new Cipher();
cipher.reprompt = 999 as any; // Invalid value
cipher.type = CipherType.Login;
const sdkCipher = cipher.toSdkCipher();
expect(sdkCipher.reprompt).toBe(SdkCipherRepromptType.None);
});💭 Finding 3: Consider validating The Question: Could the SDK ever send an invalid value that we need to handle? If so, should we add similar validation in libs/common/src/vault/models/domain/cipher.ts:503 Recommendations
|
|
Great job! No new security vulnerabilities introduced in this pull request |
| reprompt: | ||
| this.reprompt === CipherRepromptType.Password | ||
| ? CipherRepromptType.Password | ||
| : CipherRepromptType.None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Good defensive validation here! This ensures only valid SDK enum values are passed.
However, this change needs test coverage. The existing test in cipher.spec.ts only tests CipherRepromptType.None. Consider adding tests for:
reprompt: CipherRepromptType.Password→ should map toSdkCipherRepromptType.Password- Invalid values → should default to
SdkCipherRepromptType.None
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #17513 +/- ##
=======================================
Coverage 41.25% 41.26%
=======================================
Files 3546 3546
Lines 102040 102041 +1
Branches 15308 15309 +1
=======================================
+ Hits 42095 42103 +8
+ Misses 58180 58173 -7
Partials 1765 1765 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|

🎟️ Tracking
📔 Objective
📸 Screenshots
⏰ Reminders before review
🦮 Reviewer guidelines
:+1:) or similar for great changes:memo:) or ℹ️ (:information_source:) for notes or general info:question:) for questions:thinking:) or 💭 (:thought_balloon:) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion:art:) for suggestions / improvements:x:) or:warning:) for more significant problems or concerns needing attention:seedling:) or ♻️ (:recycle:) for future improvements or indications of technical debt:pick:) for minor or nitpick changes