Skip to content

Conversation

nick-livefront
Copy link
Contributor

@nick-livefront nick-livefront commented Oct 14, 2025

๐ŸŽŸ๏ธ Tracking

PM-26772

๐Ÿ“” Objective

When importing archived ciphers:

  • Into an organization, throw an error. Archived ciphers are not allowed in organizations
  • Into a personal vault, persist the archive date so the ciphers still appear in the archived vault.

๐Ÿฆฎ 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

@nick-livefront nick-livefront requested review from a team as code owners October 14, 2025 03:09
@nick-livefront nick-livefront requested a review from r-tome October 14, 2025 03:09
Copy link

codecov bot commented Oct 14, 2025

Codecov Report

โŒ Patch coverage is 42.85714% with 4 lines in your changes missing coverage. Please review.
โœ… Project coverage is 54.81%. Comparing base (42568b6) to head (3d374b0).
โš ๏ธ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
...c/Api/Tools/Controllers/ImportCiphersController.cs 25.00% 2 Missing and 1 partial โš ๏ธ
...dminConsole/Helpers/BulkResourceCreationService.cs 66.66% 0 Missing and 1 partial โš ๏ธ
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6452      +/-   ##
==========================================
+ Coverage   50.73%   54.81%   +4.07%     
==========================================
  Files        1866     1866              
  Lines       82705    82704       -1     
  Branches     7310     7321      +11     
==========================================
+ Hits        41961    45332    +3371     
+ Misses      39143    35690    -3453     
- Partials     1601     1682      +81     

โ˜” 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
Contributor

github-actions bot commented Oct 14, 2025

Logo
Checkmarx One โ€“ Scan Summary & Details โ€“ 9a46da06-c74e-4670-8645-ed40b1cf1eb3

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

Comment on lines +77 to +82
var archivedCiphers = model.Ciphers.Where(c => c.ArchivedDate.HasValue).ToList();
if (archivedCiphers.Any())
{
throw new BadRequestException("You cannot import archived items into an organization.");
}

Copy link
Contributor

Choose a reason for hiding this comment

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

โš ๏ธ A more efficient way to check this, is to use Any() to filter, as it will exit as soon as it finds a match. Calling Where() and ToList() will execute on all ciphers to create a separate List of ciphers, which then is just checked once and not needed anymore.

Suggested change
var archivedCiphers = model.Ciphers.Where(c => c.ArchivedDate.HasValue).ToList();
if (archivedCiphers.Any())
{
throw new BadRequestException("You cannot import archived items into an organization.");
}
if (model.Ciphers.Any(c => c.ArchivedDate.HasValue))
{
throw new BadRequestException("You cannot import archived items into an organization.");
}

);
}

[Theory, BitAutoData]
Copy link
Contributor

Choose a reason for hiding this comment

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

โš ๏ธ There's no test to verify importing into an organization with archived ciphers will throw a BadRequestException

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.

2 participants