Skip to content

Conversation

dani-garcia
Copy link
Member

@dani-garcia dani-garcia commented Apr 25, 2025

🎟️ Tracking

📔 Objective

With the removal of the lifetimes of the clients, we can remove the wasm-specific crypto client and instead use the one in bitwarden-core.

⏰ 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

Copy link
Contributor

github-actions bot commented Apr 25, 2025

Logo
Checkmarx One – Scan Summary & Details9dfcf77b-6a0c-40f7-a492-a717a88a747a

Great job, no security vulnerabilities found in this Pull Request

Copy link

Copy link

codecov bot commented Apr 25, 2025

Codecov Report

Attention: Patch coverage is 36.66667% with 19 lines in your changes missing coverage. Please review.

Project coverage is 70.36%. Comparing base (09fe7cd) to head (2cb7e02).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
...bitwarden-core/src/key_management/crypto_client.rs 0.00% 13 Missing ⚠️
crates/bitwarden-core/src/key_management/crypto.rs 50.00% 5 Missing ⚠️
crates/bitwarden-wasm-internal/src/client.rs 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #226      +/-   ##
==========================================
+ Coverage   70.29%   70.36%   +0.07%     
==========================================
  Files         216      215       -1     
  Lines       17060    17043      -17     
==========================================
+ Hits        11992    11993       +1     
+ Misses       5068     5050      -18     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@dani-garcia dani-garcia marked this pull request as ready for review April 25, 2025 16:44
@dani-garcia dani-garcia requested a review from a team as a code owner April 25, 2025 16:44
# Conflicts:
#	Cargo.lock
#	crates/bitwarden-core/src/mobile/crypto.rs
#	crates/bitwarden-wasm-internal/src/client.rs
#	crates/bitwarden-wasm-internal/src/lib.rs
Hinton
Hinton previously approved these changes May 29, 2025
Copy link
Member

Choose a reason for hiding this comment

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

suggestion: Could we lift this out of mobile?

Copy link
Member Author

Choose a reason for hiding this comment

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

Sounds reasonable yeah, do you think we should just lift it into the root? Or maybe into the key-management folder?

Copy link
Member

Choose a reason for hiding this comment

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

I think we can lift it into KM, @quexten would you be alright with that, I think everything currently falls under KM domain.

Copy link
Contributor

@quexten quexten May 29, 2025

Choose a reason for hiding this comment

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

Seems reasonable!

My question here (non-blocking, but needs clarification): Does key-management (the folder) really refer to the KM team, or the key-management capabilities (key store, key context) of the sdk?

The KM domain is not directly the same (Biometrics, Crypto Primitives).

Copy link
Member Author

Choose a reason for hiding this comment

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

So the way I'm thinking about this is like this:

The crypto client that I'm moving to the key_management folder is mostly a thin compatibility layer on top of the bitwarden-crypto types to make the functionality more usable for FFI (By exposing a client, instead of relying on types like MasterKey, etc, which aren't usable in FFI). In that sense, once KM officially owns bitwarden-crypto, this folder should come with, as it's fairly tied to the API exposed by bitwarden-crypto. In the future, if we find a way to expose the normal bitwarden-crypto API through FFI this module could be removed.

The other thing in the key_management folder is the definition of KeyIds used by the Key Store from bitwarden-crypto. I think of this and the Key Store as part of KM's field to expose safe to use crypto, so in my mind it would be part of your domain. The reason I defined these outside the crypto crate was to ensure the system was generic and easily expandable, but I'm not sure if that's worth it. If not, we can always move it into bitwarden-crypto directly and simplify ownership.

Hinton
Hinton previously approved these changes May 29, 2025
renovate bot and others added 3 commits June 2, 2025 16:37
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
|
[sonarsource/sonarqube-scan-action](https://redirect.github.com/sonarsource/sonarqube-scan-action)
| action | major | `v4.2.1` -> `v5.2.0` |

---

### Release Notes

<details>
<summary>sonarsource/sonarqube-scan-action
(sonarsource/sonarqube-scan-action)</summary>

###
[`v5.2.0`](https://redirect.github.com/SonarSource/sonarqube-scan-action/releases/tag/v5.2.0)

[Compare
Source](https://redirect.github.com/sonarsource/sonarqube-scan-action/compare/v5.1.0...v5.2.0)

##### What's Changed

- SQSCANGHA-90 remove mend dead conf by
[@&#8203;pierre-guillot-gh](https://redirect.github.com/pierre-guillot-gh)
in
[https://github.com/SonarSource/sonarqube-scan-action/pull/184](https://redirect.github.com/SonarSource/sonarqube-scan-action/pull/184)
- SQSCANGHA-89 Attempt to fix command injection by
[@&#8203;henryju](https://redirect.github.com/henryju) in
[https://github.com/SonarSource/sonarqube-scan-action/pull/186](https://redirect.github.com/SonarSource/sonarqube-scan-action/pull/186)
- SQSCANGHA-93 Fix madhead/semver-utils' version by
[@&#8203;csaba-feher-sonarsource](https://redirect.github.com/csaba-feher-sonarsource)
in
[https://github.com/SonarSource/sonarqube-scan-action/pull/187](https://redirect.github.com/SonarSource/sonarqube-scan-action/pull/187)
- SQSCANGHA-94 Update version update logic by
[@&#8203;csaba-feher-sonarsource](https://redirect.github.com/csaba-feher-sonarsource)
in
[https://github.com/SonarSource/sonarqube-scan-action/pull/188](https://redirect.github.com/SonarSource/sonarqube-scan-action/pull/188)
- SQSCANGHA-92 Validate scanner version by
[@&#8203;csaba-feher-sonarsource](https://redirect.github.com/csaba-feher-sonarsource)
in
[https://github.com/SonarSource/sonarqube-scan-action/pull/189](https://redirect.github.com/SonarSource/sonarqube-scan-action/pull/189)

**Full Changelog**:
SonarSource/sonarqube-scan-action@v5...v5.2.0

###
[`v5.1.0`](https://redirect.github.com/SonarSource/sonarqube-scan-action/releases/tag/v5.1.0)

[Compare
Source](https://redirect.github.com/sonarsource/sonarqube-scan-action/compare/v5.0.0...v5.1.0)

#### What's Changed

- Update SonarScanner CLI to 7.1.0.4889 to support sonar.region=us by
[@&#8203;github-actions](https://redirect.github.com/github-actions) in
[https://github.com/SonarSource/sonarqube-scan-action/pull/183](https://redirect.github.com/SonarSource/sonarqube-scan-action/pull/183)

**Full Changelog**:
SonarSource/sonarqube-scan-action@v5.0.0...v5.1.0

###
[`v5.0.0`](https://redirect.github.com/SonarSource/sonarqube-scan-action/releases/tag/v5.0.0)

[Compare
Source](https://redirect.github.com/sonarsource/sonarqube-scan-action/compare/v4.2.1...v5.0.0)

##### What's Changed

- SQSCANGHA-81 Update SonarScanner CLI to 7.0.2.4839 by
[@&#8203;github-actions](https://redirect.github.com/github-actions) in
[https://github.com/SonarSource/sonarqube-scan-action/pull/175](https://redirect.github.com/SonarSource/sonarqube-scan-action/pull/175)

**Full Changelog**:
SonarSource/sonarqube-scan-action@v4...v5.0.0

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "every 2nd week starting on the 2 week
of the year before 4am on Monday" (UTC), Automerge - At any time (no
schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/).
View the [repository job
log](https://developer.mend.io/github/bitwarden/sdk-internal).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MC4xNi4wIiwidXBkYXRlZEluVmVyIjoiNDAuMTYuMCIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
## 🎟️ Tracking

<!-- Paste the link to the Jira or GitHub issue or otherwise describe /
point to where this change is coming from. -->

## 📔 Objective

<!-- Describe what the purpose of this PR is, for example what bug
you're fixing or new feature you're adding. -->

This is an old type we created before we supported `EncString` as an FFI
type.

## ⏰ 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

<!-- Suggested interactions but feel free to use (or not) as you desire!
-->

- 👍 (`:+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
# Conflicts:
#	crates/bitwarden-wasm-internal/src/client.rs
#	crates/bitwarden-wasm-internal/src/crypto.rs
Copy link

@dani-garcia dani-garcia merged commit 0e948af into main Jun 11, 2025
43 checks passed
@dani-garcia dani-garcia deleted the ps/unify-wasm-crypto branch June 11, 2025 17:14
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.

4 participants