Skip to content

Conversation

@r-tome
Copy link
Contributor

@r-tome r-tome commented Jan 15, 2026

🎟️ Tracking

https://bitwarden.atlassian.net/browse/PM-29045

📔 Objective

Fixes a bug where ciphers cannot be permanently deleted from trash after their collections are deleted.

Changed DeleteAdmin to use GetByIdAsyncAdmin() which bypasses collection filtering, matching the behavior of PutDeleteAdmin and PutRestoreAdmin.

📸 Screenshots

⏰ 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

When a cipher's collection is deleted, the cipher becomes orphaned and
cannot be permanently deleted. Changed DeleteAdmin to use GetByIdAsyncAdmin
to bypass collection-based filtering, consistent with other admin endpoints.
This commit introduces a new test class for the CiphersController, implementing integration tests to verify the behavior of cipher deletion and restoration when associated collections are deleted. The tests ensure that orphaned ciphers can be deleted and restored correctly, maintaining data integrity across multiple collections.
@r-tome r-tome marked this pull request as ready for review January 15, 2026 18:21
@r-tome r-tome requested a review from a team as a code owner January 15, 2026 18:21
@github-actions
Copy link
Contributor

github-actions bot commented Jan 15, 2026

Logo
Checkmarx One – Scan Summary & Detailsb22582fc-9ff4-4903-aae1-f6d84bb6bedc

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

r-tome and others added 2 commits January 16, 2026 11:04
…c for repository calls

Updated tests in CiphersControllerTests to replace GetByIdAsync with GetOrganizationDetailsByIdAsync for fetching cipher details. Adjusted assertions in delete and restore admin methods to ensure correct organization context is maintained. This change enhances clarity and consistency in the test suite.
@codecov
Copy link

codecov bot commented Jan 16, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 56.17%. Comparing base (ebb0712) to head (10faa9c).
⚠️ Report is 22 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6851      +/-   ##
==========================================
- Coverage   59.90%   56.17%   -3.73%     
==========================================
  Files        1966     1966              
  Lines       86883    86883              
  Branches     7741     7741              
==========================================
- Hits        52046    48810    -3236     
- Misses      32954    36255    +3301     
+ Partials     1883     1818      -65     

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

Copy link
Collaborator

@jaasen-livefront jaasen-livefront left a comment

Choose a reason for hiding this comment

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

Looks good. Thanks for the tests!

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants