Skip to content

feat(platform): let an SdkRecordMapper exclude records from SDK-visible state - #22168

Closed
Hinton wants to merge 1 commit into
mainfrom
pam/sdk-record-should-include
Closed

feat(platform): let an SdkRecordMapper exclude records from SDK-visible state#22168
Hinton wants to merge 1 commit into
mainfrom
pam/sdk-record-should-include

Conversation

@Hinton

@Hinton Hinton commented Jul 31, 2026

Copy link
Copy Markdown
Member

🎟️ Tracking

Prerequisite for the PAM cipher-gating stack (#22169#22170#22171). Small and
generic — no PAM knowledge needed to review.

📔 Objective

Adds an optional shouldInclude predicate to SdkRecordMapper. When it returns false for
a record, RepositoryRecord.get returns null and list() omits it, so the SDK never has
to parse a record it cannot represent.

Writes are deliberately unfiltered: the record still round-trips through client state
and stays readable via the client's own services. Only the SDK-facing view is narrowed.

The consumer is #22169, where PAM-gated ciphers are hidden from the SDK — it has no
partial-data decrypt path and rejects sparsely-populated ciphers with a serde
invalid type: unit value error.

Verification

npm test -- libs/common/src/platform/services/sdk/client-managed-state.spec.ts — 40
passed (35 existing + 5 new, covering both get/list filtering, the no-predicate
default, and that writes still land).

🚨 Breaking Changes

None — the predicate is optional and existing mappers include everything, exactly as before.

…le state

Adds an optional `shouldInclude` predicate to SdkRecordMapper. When it
returns false for a record, RepositoryRecord.get returns null and list()
omits it, so the SDK never has to parse a record it cannot represent.

Writes are deliberately unfiltered: the record still round-trips through
client state and stays readable via the client's own services. Only the
SDK-facing view is narrowed.

No behavior change for existing mappers - the predicate is optional and
absent ones include everything.
@Hinton Hinton changed the title pam/sdk record should include feat(platform): let an SdkRecordMapper exclude records from SDK-visible state Jul 31, 2026
@codecov

codecov Bot commented Jul 31, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 52.72%. Comparing base (34a38c3) to head (03754f7).
⚠️ Report is 3 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #22168   +/-   ##
=======================================
  Coverage   52.72%   52.72%           
=======================================
  Files        4203     4203           
  Lines      133154   133159    +5     
  Branches    20957    20958    +1     
=======================================
+ Hits        70201    70211   +10     
+ Misses      57819    57815    -4     
+ Partials     5134     5133    -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.

Hinton added a commit that referenced this pull request Aug 6, 2026
…pivot)

Pivots the PAM cipher-gating client work: instead of hiding gated rows
from the SDK and hand-decrypting them, gated rows now flow through the
SDK, which decrypts the reduced envelope into a `partial` view
(bitwarden/sdk-internal#1359).

- Revert the SdkRecordMapper `shouldInclude` filter and the
  `decryptPartialCiphers` path (the last caller of the deprecated
  `Cipher.decrypt`). Gated rows go through `decryptMany*` like any cipher.
- CipherResponse passes `partialData` through verbatim (no client lift);
  `Cipher.toSdkCipher`/`fromSdkCipher` map it both ways so it round-trips
  losslessly (re-attach hack removed). The decrypted view's gating marker
  is the SDK's `partial` boolean.
- Vault seams read `view.partial`; `CipherOpenVerdict` gains a `handled`
  case so the open gate can block the open and surface the "Privileged
  Controls license required" dialog (unlicensed-user design).
- Move the "Privileged" badge into a dedicated "Controlled access" column,
  shown only when a PAM-enabled org (`Organization.usePam`) is in view and
  the badge seam is provided.

Depends on sdk-internal#1359 (adds Cipher.partial_data + the `partial`
view flag + the restricted decrypt path); the `@bitwarden/sdk-internal`
bump lands once that publishes. Supersedes #22168, #22169, #22170.
@Hinton

Hinton commented Aug 6, 2026

Copy link
Copy Markdown
Member Author

Superseded by #22171 — the PAM cipher-gating client work pivoted to route gated ciphers through the SDK (sdk-internal#1359) instead of filtering them out. See #22171.

@Hinton Hinton closed this Aug 6, 2026
Hinton added a commit that referenced this pull request Aug 6, 2026
…pivot)

Pivots the PAM cipher-gating client work: instead of hiding gated rows
from the SDK and hand-decrypting them, gated rows now flow through the
SDK, which decrypts the reduced envelope into a `partial` view
(bitwarden/sdk-internal#1359).

- Revert the SdkRecordMapper `shouldInclude` filter and the
  `decryptPartialCiphers` path (the last caller of the deprecated
  `Cipher.decrypt`). Gated rows go through `decryptMany*` like any cipher.
- CipherResponse passes `partialData` through verbatim (no client lift);
  `Cipher.toSdkCipher`/`fromSdkCipher` map it both ways so it round-trips
  losslessly (re-attach hack removed). The decrypted view's gating marker
  is the SDK's `partial` boolean.
- Vault seams read `view.partial`; `CipherOpenVerdict` gains a `handled`
  case so the open gate can block the open and surface the "Privileged
  Controls license required" dialog (unlicensed-user design).
- Move the "Privileged" badge into a dedicated "Controlled access" column,
  shown only when a PAM-enabled org (`Organization.usePam`) is in view and
  the badge seam is provided.

Depends on sdk-internal#1359 (adds Cipher.partial_data + the `partial`
view flag + the restricted decrypt path); the `@bitwarden/sdk-internal`
bump lands once that publishes. Supersedes #22168, #22169, #22170.
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.

1 participant