Skip to content

Conversation

@aj-rosado
Copy link
Contributor

🎟️ Tracking

📔 Objective

If the user has active ITEM_RESTRICTION policies.

Will not request card types from other password managers
If the data still contains card data, this will filter the card types out of the import if the importing data

⏰ 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

@github-actions
Copy link
Contributor

github-actions bot commented Nov 5, 2025

Logo
Checkmarx One – Scan Summary & Details1c38eebc-a99c-4a4b-aa69-16ad6dea0ff6

Great job! No new security vulnerabilities introduced in this pull request

@aj-rosado aj-rosado changed the title Pm 27119/cxp prevent card item imported item restricted policy [PM-27119] Prevent import card data when ITEM_RESTRICT_TYPES policy is active Nov 5, 2025
@codecov
Copy link

codecov bot commented Nov 5, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 84.96%. Comparing base (d86443c) to head (c24f1fd).
⚠️ Report is 17 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6123      +/-   ##
==========================================
+ Coverage   84.82%   84.96%   +0.13%     
==========================================
  Files         721      737      +16     
  Lines       52824    53069     +245     
  Branches     7667     7664       -3     
==========================================
+ Hits        44808    45090     +282     
+ Misses       5328     5296      -32     
+ Partials     2688     2683       -5     

☔ 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.

@codecov
Copy link

codecov bot commented Nov 5, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 84.99%. Comparing base (510072b) to head (0995f1e).
⚠️ Report is 21 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6123      +/-   ##
==========================================
+ Coverage   84.96%   84.99%   +0.02%     
==========================================
  Files         724      723       -1     
  Lines       52758    52747      -11     
  Branches     7659     7652       -7     
==========================================
+ Hits        44826    44832       +6     
+ Misses       5249     5242       -7     
+ Partials     2683     2673      -10     

☔ 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.

@aj-rosado aj-rosado marked this pull request as ready for review November 6, 2025 09:20
@claude
Copy link
Contributor

claude bot commented Nov 6, 2025

Claude finished @aj-rosado's task —— View job


Code Review Complete

Summary

Implementation successfully prevents card imports when ITEM_RESTRICT_TYPES policy is active. Defense-in-depth approach (filtering at ViewModel and Manager layers) is sound. Test coverage is comprehensive.

Findings

Finding 1: Unnecessary suppression annotation remains in test file


Details

The PR implements a two-layer filtering approach:

  1. ViewModel layer (ImportItemsViewModel:129): Prevents requesting card types from credential providers
  2. Manager layer (CredentialExchangeImportManagerImpl:105): Filters cards if they appear in import data

This defense-in-depth pattern is appropriate given that credential providers may return cards regardless of request parameters.

Helper method PolicyManager.hasRestrictItemTypes() properly centralizes the policy check logic, avoiding duplication.

Test coverage is thorough with 4 new test cases covering all scenarios including edge case where all ciphers are cards.


if (cipherList.isEmpty()) {
// Filter out card ciphers if RESTRICT_ITEM_TYPES policy is active
val filteredCipherList = if (policyManager.hasRestrictItemTypes()) {
cipherList.filter { cipher -> cipher.type != CipherType.CARD }
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could the restriction be for a different type?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right now we only have restrictions for cards and I do not think we have future work to change that.

}
}

@Suppress("MaxLineLength")
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think we need this suppression.

}
}

@Suppress("MaxLineLength")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Don't need the suppression

}
}

@Suppress("MaxLineLength")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Don't need the suppression

assertTrue(result is ImportCxfPayloadResult.Error)
}

@Suppress("MaxLineLength")
Copy link
Collaborator

Choose a reason for hiding this comment

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

We don't need this suppression

}
}

@Suppress("MaxLineLength")
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Finding 1: Unnecessary suppression annotation

The @Suppress("MaxLineLength") annotation is not needed for this test function. The function name length (97 characters) does not violate the max line length rule, which typically applies to code lines, not function names in tests using backticks.

Per david-livefront's review comment, this suppression should be removed.

@aj-rosado aj-rosado added this pull request to the merge queue Nov 11, 2025
Merged via the queue into main with commit 5eb56ca Nov 11, 2025
15 of 17 checks passed
@aj-rosado aj-rosado deleted the PM-27119/cxp-prevent-card-item-imported-item-restricted-policy branch November 11, 2025 19:57
dev-sharma3624 pushed a commit to dev-sharma3624/android that referenced this pull request Nov 12, 2025
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.

3 participants