-
Notifications
You must be signed in to change notification settings - Fork 1.5k
[PM-25947] Add folders and favorites when sharing a cipher #6402
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 @nick-livefront's task ββ View job Code Review CompleteTodo List:
Comprehensive Code Review - PR #6402Overall Assessment: APPROVE WITH RECOMMENDATIONSThis PR successfully addresses the issue of preserving folder and favorite attributes when sharing ciphers from personal vault to organization. The implementation has evolved significantly through multiple iterations and now demonstrates solid data integrity handling. Security Assessment: PASSZero-Knowledge Principles: β Maintained
Data Integrity: β Good
Compliance: β Maintained
Code Quality Analysisβ Strengths
Issues Identified
|
| Priority | Issue | Location | Action Required |
|---|---|---|---|
| Add error handling for JSON deserialization | CipherRequestModel.cs:309 | Recommended before merge | |
| π¨ SUGGESTED | Add unit tests for UpdateUserSpecificJsonField | Test coverage gap | Consider for future PR |
| π¨ SUGGESTED | Add GUID validation for FolderId | CipherRequestModel.cs:323 | Optional improvement |
| β QUESTION | Performance monitoring | Runtime behavior | Monitor in production |
Final Verdict: APPROVE WITH RECOMMENDATIONS
This PR successfully solves the stated problem and demonstrates good software engineering practices. The implementation has improved significantly through multiple review iterations. The main remaining concern is error handling for malformed JSON, which I recommend addressing before merge to ensure production resilience.
Key Achievements:
- β Preserves folder and favorite attributes when sharing ciphers
- β Maintains data integrity for multi-user organization ciphers
- β Comprehensive test coverage for main scenarios
- β Database migration properly implemented
- β Security and compliance standards maintained
- β Previous reviewer feedback addressed (JSON key format, migration date)
Recommended Actions Before Merge:
- Add try-catch error handling around JSON deserialization (or document why it's not needed)
- Consider adding unit tests for
UpdateUserSpecificJsonFieldedge cases
Post-Merge Recommendations:
- Monitor performance metrics for cipher share operations
- Watch for any JSON deserialization errors in logs
- Consider extracting JSON manipulation logic to a service class if it grows more complex
References
- Jira: PM-25947
- Related ADRs: ADR 0024 (nullable reference types), ADR 0026 (TryAdd pattern)
- Previous Reviews: Issues with JSON key format and migration date addressed
- Security Whitepaper: Zero-knowledge principles maintained
|
Great job! No new security vulnerabilities introduced in this pull request |
| existingCipher.Reprompt = Reprompt; | ||
| existingCipher.Key = Key; | ||
| existingCipher.ArchivedDate = ArchivedDate; | ||
| existingCipher.Folders = userIdKey != null && FolderId != null ? |
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.
server/src/Sql/dbo/Vault/Stored Procedures/Cipher/CipherDetails_Update.sql
Lines 36 to 53 in 4e64d35
| [Folders] = | |
| CASE | |
| WHEN @FolderId IS NOT NULL AND [Folders] IS NULL THEN | |
| CONCAT('{', @UserIdKey, ':"', @FolderId, '"', '}') | |
| WHEN @FolderId IS NOT NULL THEN | |
| JSON_MODIFY([Folders], @UserIdPath, CAST(@FolderId AS VARCHAR(50))) | |
| ELSE | |
| JSON_MODIFY([Folders], @UserIdPath, NULL) | |
| END, | |
| [Favorites] = | |
| CASE | |
| WHEN @Favorite = 1 AND [Favorites] IS NULL THEN | |
| CONCAT('{', @UserIdKey, ':true}') | |
| WHEN @Favorite = 1 THEN | |
| JSON_MODIFY([Favorites], @UserIdPath, CAST(1 AS BIT)) | |
| ELSE | |
| JSON_MODIFY([Favorites], @UserIdPath, NULL) | |
| END, |
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.
That's pretty cool that Claude identified the same thing! Or at least had a hunch
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.
Codecov Reportβ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #6402 +/- ##
==========================================
+ Coverage 53.87% 57.77% +3.89%
==========================================
Files 1914 1914
Lines 84957 84982 +25
Branches 7599 7606 +7
==========================================
+ Hits 45773 49098 +3325
+ Misses 37422 34045 -3377
- Partials 1762 1839 +77 β View full report in Codecov by Sentry. π New features to boost your workflow:
|
β¦s/favorite assignments on a cipher
|
Claude finished @nick-livefront's task ββ View job PR Review AnalysisI've thoroughly analyzed this pull request and identified significant improvements in the implementation, but there are still critical concerns that need attention. Todo List:
π Excellent ImprovementsThe updated implementation addresses most of the concerns from my previous review:
|
|
Claude finished @nick-livefront's task ββ View job PR Review AnalysisI've thoroughly analyzed this pull request that addresses sharing ciphers with folder and favorite attributes. The implementation shows significant improvements from previous reviews, but there are still some important considerations. Todo List:
π Excellent ImprovementsThe updated implementation addresses most of the critical concerns from previous reviews:
|
|
theMickster
left a comment
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.
π¨ Given that we have a bug that we are squashing (nice work!), what's our team consensus/goal/standards/etc. on writing covering unit test(s) and/or integration tests?
β¦/pm-25957/sharing-cipher-to-org
|
Claude finished @nick-livefront's task ββ View job PR Code Review AnalysisI've completed a thorough analysis of this pull request that fixes folder and favorite attributes being lost when sharing ciphers from personal vault to organization. Todo List:
π Excellent ImprovementsThis implementation shows significant evolution from previous reviews, with major improvements addressing data integrity concerns:
|
@theMickster Great thought, I agree we should be adding them wherever we can π Appreciate the nudge to do so! |
|
I'm good with the PR so long as @shane-melton double-checks that his concern was properly addressed. |
shane-melton
left a comment
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.
π
jaasen-livefront
left a comment
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.
π―
8555946
|
@shane-melton @jaasen-livefront @bitwarden/dept-dbops This failed to pass QA and after a fresh install of the server repo, my fix was not working. When initially building I must have DB made these changes locally but never pushed them to this PR. I added DB changes to capture the |
mkincaid-bw
left a comment
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.
LGTM
|
@nick-livefront Actually, we should probably bump the migration script date/name first before merge. |
@nick-livefront Actually, we should probably bump the migration script date/name first before merge.
@shane-melton I'll dismiss your review as a reminder and I'll need an approval again after making the edit. I'll wait for this to get through QA though so the date is closer to the merge date.
β¦7/sharing-cipher-to-org
@shane-melton @mkincaid-bw Updated the migration timestamp here: 8ff4d2d |




ποΈ Tracking
PM-25947
π Objective
When sharing a cipher from a personal vault to an organization the folder and favorite attributes were being lost in the
toCiphermethod.πΈ Screenshots
Screen.Recording.2025-09-30.at.3.22.59.PM.mov