Skip to content

[PM-23085] Use SDK to get rotated cipher data #15670

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

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

shane-melton
Copy link
Member

@shane-melton shane-melton commented Jul 17, 2025

🎟️ Tracking

PM-23085

📔 Objective

Add a new encryptCipherForRotation method to the cipher encryption service that utilizes the SDK to encrypt a cipher with a specific key for key rotation support.

Requires SDK PR: bitwarden/sdk-internal#350

⏰ Reminders before review

  • Contributor guidelines followed
  • All formatters and local linters executed and passed
  • Written new unit and / or integration tests where applicable
  • Protected functional changes with optionality (feature flags)
  • Used internationalization (i18n) for all UI strings
  • CI builds passed
  • Communicated to DevOps any deployment requirements
  • Updated any necessary documentation (Confluence, contributing docs) or informed the documentation team

🦮 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

@shane-melton shane-melton requested a review from a team as a code owner July 17, 2025 23:06
Copy link
Contributor

github-actions bot commented Jul 17, 2025

Logo
Checkmarx One – Scan Summary & Details9962b7ab-98cf-403b-9525-ff3f176e12bb

Great job, no security vulnerabilities found in this Pull Request

Base automatically changed from vault/pm-23348/sdk-move-to-cipher-to-org to vault/pm-22136/cipher-encryption-service July 21, 2025 17:12
Base automatically changed from vault/pm-22136/cipher-encryption-service to main July 22, 2025 06:27
@shane-melton shane-melton requested a review from a team as a code owner July 22, 2025 06:27
Copy link
Contributor

@djsmith85 djsmith85 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a couple of conflicts and the tools changes seemed very familiar. I assume the same work as #15337 and this PR just needs to be updated

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔 Seems like there might be parts of the importers that might check for the null sentinel values it sets here. Did you find any?

@shane-melton shane-melton force-pushed the vault/pm-23085/sdk-rotated-cipher-data branch from 343ab09 to d1af2d8 Compare July 22, 2025 23:42
@djsmith85 djsmith85 removed their request for review July 23, 2025 10:37
@djsmith85
Copy link
Contributor

Removed myself as a reviewer, as a review from tools is no longer needed, after updating from main.

@shane-melton shane-melton dismissed djsmith85’s stale review July 23, 2025 22:05

No longer impacts tools owned code

Copy link
Contributor

@gbubemismith gbubemismith left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀 🔥 Changes look good! I have approved the SDK PR, will approve this once you update the SDK version

@shane-melton
Copy link
Member Author

shane-melton commented Jul 25, 2025

@gbubemismith Updated the package.json with the correct @bitwarden/sdk-internal package version.

gbubemismith
gbubemismith previously approved these changes Jul 25, 2025
@gbubemismith
Copy link
Contributor

@shane-melton I think some tests are failing

@shane-melton
Copy link
Member Author

shane-melton commented Jul 25, 2025

@gbubemismith 🤦 I forgot to rename the method in the cipher service spec, should be good to go now!

gbubemismith
gbubemismith previously approved these changes Jul 25, 2025
@@ -32,6 +33,18 @@ export abstract class CipherEncryptionService {
userId: UserId,
): Promise<EncryptionContext | undefined>;

/**
* Encrypts cipher for a given userId with a new key for key rotation.
* @param model The cipher view encrypt
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @param model The cipher view encrypt
* @param model The cipher view to encrypt

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

f4d8370 Thanks!

Copy link

Copy link
Collaborator

@jaasen-livefront jaasen-livefront left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀 🚀 🚀

Copy link

codecov bot commented Jul 25, 2025

Codecov Report

❌ Patch coverage is 63.63636% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 37.78%. Comparing base (ae79080) to head (f4d8370).
⚠️ Report is 2 commits behind head on main.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...ault/services/default-cipher-encryption.service.ts 55.55% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #15670      +/-   ##
==========================================
- Coverage   37.85%   37.78%   -0.08%     
==========================================
  Files        3309     3309              
  Lines       94008    94021      +13     
  Branches    14248    14250       +2     
==========================================
- Hits        35585    35524      -61     
- Misses      56924    56998      +74     
  Partials     1499     1499              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants