Skip to content

Update sdk-internal to 0.2.0-main.1202 - #24456

Merged
quexten merged 2 commits into
mainfrom
sdlc/sdk-update
Nov 5, 2026
Merged

quexten merged 2 commits into
mainfrom
sdlc/sdk-update

Conversation

@bw-ghapp

@bw-ghapp bw-ghapp Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

🤖 Automated SDK Update

This PR updates the SDK packages to version 0.2.0-main.1202.

Changes

  • @bitwarden/sdk-internal: 0.2.0-main.1201 → 0.2.0-main.1202
  • @bitwarden/commercial-sdk-internal: 0.2.0-main.1201 → 0.2.0-main.1202

What's Changed in SDK

Raw changelog
- [PM-46038] feat: Store the PIN length (#1708)

Links

@bw-ghapp bw-ghapp Bot added automated pr PR created by workflow or other automation t:deps Change Type - Dependencies labels Nov 5, 2026
@claude

claude Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @bw-ghapp[bot]'s task in 13m 20s —— View job


SDK bump evaluated

@bitwarden/sdk-internal and @bitwarden/commercial-sdk-internal: 0.2.0-main.1201 → 0.2.0-main.1202.

sdk-internal range 67d741eb6ea0fcea776ea82fd95495fcc5704012..9910210177161d379464b6e68109091962e7b263 — 1 commit. Surface diff: 4 added declarations, 0 removed, 0 mutated; identical in both the OSS and commercial packages.

Compile-time breaks

One break, found and fixed. The verifying npm run test:types passed cleanly — every leg exited with code 0, and typescript-strict-plugin reported 🎉 All files passed across 4884 strict files. The baseline run had failed with 3 errors.

bitwarden/sdk-internal#1708 added three required members to the WasmStateBridge interface:

set_pin_length(value: number): Promise<void>;
get_pin_length(): Promise<number | null>;
clear_pin_length(): Promise<void>;

JsWasmStateBridge is this repo's only implementor, so it stopped satisfying the interface:

  • libs/common/src/key-management/state-bridge.ts:87 — TS2420, Class 'JsWasmStateBridge' incorrectly implements interface 'WasmStateBridge'
  • libs/common/src/platform/services/sdk/default-sdk.service.ts:296 — TS2345 at register_bridge_impl(new JsWasmStateBridge(...))
  • libs/common/src/platform/services/sdk/register-sdk.service.ts:163 — TS2345, same call shape

The fix implements the trio on JsWasmStateBridge using the file's existing writeAtomic / readAtomic / deleteAtomic helpers, backed by a new PIN_LENGTH state key. The two register_bridge_impl sites needed no edit of their own — they were downstream of the TS2420 and cleared with it.

Runtime considerations

  • The PIN's character count is now persisted unencrypted, on disk. That is the upstream contract, not a local choice: the SDK's own doc comment states it is "stored unencrypted so a lock screen can read it while locked, e.g. to try the PIN as soon as that many characters are typed." The new key is therefore PIN_DISK / "pinLength" with clearOn: ["logout"] — PIN_MEMORY would not survive lock and would silently defeat the feature. It does narrow a brute-force search space for anyone with disk access; that trade-off was made in [PM-46038] feat: Store the PIN length sdk-internal#1708 and is a question for @bitwarden/team-key-management-dev on the SDK PR rather than something to re-litigate in a version bump.
  • No migration is needed for existing PINs. get_pin_length() returning null is an expected state for PINs enrolled before this change, and the SDK handles it: PinLockSystem::on_unlock backfills the length by decrypting the stored PIN when none is recorded. set_pin clears then sets it; unset_pin clears it.
  • No wire-value or serialization changes. The field is declared pin_length: u32 as ts "number" — a plain number with no SDK type mapping. No enum renumbering, no serde attribute changes, no features = ["wasm"] edit in range.

Everything else in range — confirmed safe

  • 99102101 PM-46038 feat: Store the PIN length (bitwarden/sdk-internal#1708) — the only commit. Beyond the bridge break above, its other surface change is PinSettingsClient.get_pin_length(): Promise<number | undefined>, a new method on an SDK-owned class with a private constructor. Purely additive: nothing in this repo implements or must call it, so libs/common/src/key-management/pin/pin.service.implementation.ts is untouched. Its remaining hunks are a bitwarden-state-bridge-macro codegen fix (integer conversion via TryFromJsValue), Rust unit tests, and the SDK's own Swift and TypeScript integration-test fixtures — none reach this repo's surface.

Checked beyond the type-check's reach per the skill's step 7: WasmStateBridge has no implementor anywhere in apps/ or bitwarden_license/ (so no break hidden behind a @ts-strict-ignore file or an unchecked app spec), and no jest.mock("@bitwarden/sdk-internal") factory stubs the state bridge.

Commit

74ae33dc7c — Implement PIN length storage in JsWasmStateBridge. Two files, +24/-0: libs/common/src/key-management/state-bridge.ts and libs/common/src/key-management/state-definitions.ts. No package.json change, no encryption logic, no logging of the PIN or its length.

Verification: npm run lint:fix clean (0 errors; the 368 warnings are pre-existing template warnings elsewhere in the repo), npx prettier --write reported both files already formatted, npm run test:types passed, and npm test -- libs/common/src/key-management --maxWorkers=2 passed 413 tests across 25 suites.

One thing left undone deliberately: no unit test was added. state-definitions.spec.ts covers only the two definitions with non-trivial deserializers, USER_KEY_ENCRYPTED_PIN and the other pass-through keys are untested there, and state-bridge.ts has no spec at all — so a test for PIN_LENGTH alone would sit oddly against the existing coverage. Happy to add one if a reviewer wants it.
· branch sdlc/sdk-update

sdk-internal 0.2.0-main.1202 adds required set/get/clear_pin_length members to WasmStateBridge (bitwarden/sdk-internal#1708). The SDK stores the PIN's character count unencrypted so a lock screen can read it while locked, so it is backed by a new PIN_DISK state key that clears on logout.
@bw-ghapp
bw-ghapp Bot requested a review from a team as a code owner November 5, 2026 04:54
@bw-ghapp
bw-ghapp Bot requested a review from quexten November 5, 2026 04:54

@quexten quexten left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approved, LLM applied diff looks correct.

@quexten
quexten enabled auto-merge (squash) November 5, 2026 04:55
@quexten
quexten merged commit 1ae4af9 into main Nov 5, 2026
149 of 151 checks passed
@quexten
quexten deleted the sdlc/sdk-update branch November 5, 2026 05:16
@codecov

codecov Bot commented Nov 5, 2026

Copy link
Copy Markdown

Codecov Report

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

Files with missing lines Patch % Lines
libs/common/src/key-management/state-bridge.ts 0.00% 3 Missing ⚠️
...ibs/common/src/key-management/state-definitions.ts 50.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main   #24456   +/-   ##
=======================================
  Coverage   61.94%   61.95%           
=======================================
  Files        4928     4928           
  Lines      158951   158963   +12     
  Branches    25502    25504    +2     
=======================================
+ Hits        98470    98484   +14     
+ Misses      53718    53715    -3     
- Partials     6763     6764    +1     

☔ View full report in Codecov by Harness.
📢 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.

@djsmith85 djsmith85 added browser Browser Extension desktop Desktop Application cli CLI Application web labels Nov 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automated pr PR created by workflow or other automation browser Browser Extension cli CLI Application desktop Desktop Application t:deps Change Type - Dependencies web

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants