Skip to content

[PM-46788] Adds flexible parser for item types policy data - #24696

Open
aaronjordan wants to merge 1 commit into
mainfrom
aj/pm-35389-manage-item-types-policy-parser
Open

aaronjordan wants to merge 1 commit into
mainfrom
aj/pm-35389-manage-item-types-policy-parser

Conversation

@aaronjordan

@aaronjordan aaronjordan commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

🎟️ Tracking

https://bitwarden.atlassian.net/browse/PM-35389
https://bitwarden.atlassian.net/browse/PM-46788

📔 Objective

This change makes it safe to adjust the shape of data for the hidden item type policy.

Currently, nothing is written to this field, but web-based clients expect it could be an array. Instead, we will be making it an object so that it works neatly with existing policy bindings/helpers.

In the end, we'll write something like

{ "restrictedTypes": [3] }

on policy 15 where we currently place null (and enabled) to represent hiding the Card type from organization users.

Screenshot 2026-11-11 at 3 09 10 PM

@aaronjordan aaronjordan changed the title [web]: Adds flexible parser for item types policy data [PM-35389] Adds flexible parser for item types policy data Nov 11, 2026
@aaronjordan aaronjordan added t:feature Change Type - Feature Development ai-review Request a Claude code review labels Nov 11, 2026
@github-actions

github-actions Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

🤖 Bitwarden Claude Code Review

Overall Assessment: APPROVE

This PR adds getRestrictedItemTypes in libs/common/src/vault/utils/restricted-item-types.utils.ts, which reads the data field of the RestrictedItemTypes policy defensively, and switches RestrictedItemTypesService to it in place of the unchecked as CipherType[] cast. The service is the only reader of this policy's data, and the admin edit definition still uses SimpleTogglePolicyComponent, so today's null payload keeps enforcing [Card]. Malformed shapes also fall back to [Card], so they fail closed. A valid { restrictedTypes } object is filtered through isCipherType and de-duplicated, and an explicitly empty list leaves that organization unrestricted. The new util and service tests cover the legacy, new, empty, and malformed shapes.

@codecov

codecov Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 63.32%. Comparing base (a0c8970) to head (4c64289).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #24696      +/-   ##
==========================================
+ Coverage   63.31%   63.32%   +0.01%     
==========================================
  Files        5006     5007       +1     
  Lines      162917   162924       +7     
  Branches    26287    26288       +1     
==========================================
+ Hits       103156   103177      +21     
+ Misses      52765    52752      -13     
+ Partials     6996     6995       -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.

@aaronjordan aaronjordan changed the title [PM-35389] Adds flexible parser for item types policy data [PM-46788] Adds flexible parser for item types policy data Nov 11, 2026
@aaronjordan
aaronjordan force-pushed the aj/pm-35389-manage-item-types-policy-parser branch from 15975e3 to ec3a78e Compare November 11, 2026 23:10
@aaronjordan
aaronjordan marked this pull request as ready for review November 11, 2026 23:31
@aaronjordan
aaronjordan requested a review from a team as a code owner November 11, 2026 23:31
@aaronjordan
aaronjordan force-pushed the aj/pm-35389-manage-item-types-policy-parser branch from ec3a78e to 4c64289 Compare November 18, 2026 17:45

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-review Request a Claude code review t:feature Change Type - Feature Development

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants