8000 [PM-22204] - update cipher/share endpoint to return revision date by jaasen-livefront · Pull Request #5900 · bitwarden/server · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

[PM-22204] - update cipher/share endpoint to return revision date #5900

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement 8000 . We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Jun 2, 2025

Conversation

jaasen-livefront
Copy link
Collaborator

🎟️ Tracking

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

📔 Objective

This PR updates the cipher/share endpoint to return revision date. Some cleanup to the Task was also done as well as specs added.

📸 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

@jaasen-livefront jaasen-livefront requested a review from a team as a code owner May 30, 2025 17:32
Copy link
Contributor
github-actions bot commented May 30, 2025

Logo
Checkmarx One – Scan Summary & Details364fb6b7-7134-4721-bf09-8aa7bd687feb

New Issues (1)

Checkmarx found the following issues in this Pull Request

Severity Issue Source File / Package Checkmarx Insight
MEDIUM CSRF /src/Api/AdminConsole/Controllers/GroupsController.cs: 164
detailsMethod Put at line 164 of /src/Api/AdminConsole/Controllers/GroupsController.cs gets a parameter from a user request from model. This parameter v...
ID: yt2PajNvte2IY7Xe%2FRtOPf8qKlo%3D
Attack Vector
Fixed Issues (1)

Great job! The following issues were fixed in this Pull Request

Severity Issue Source File / Package
CRITICAL Stored_XSS /util/Server/Startup.cs: 57

Copy link
codecov bot commented May 30, 2025

Codecov Report

Attention: Patch coverage is 69.23077% with 4 lines in your changes missing coverage. Please review.

Project coverage is 47.59%. Comparing base (d50ad97) to head (ef8f8db).
Report is 9 commits behind head on main.

Files with missing lines Patch % Lines
src/Api/Vault/Controllers/CiphersController.cs 66.66% 2 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5900      +/-   ##
==========================================
+ Coverage   47.48%   47.59%   +0.10%     
==========================================
  Files        1663     1669       +6     
  Lines       75326    75350      +24     
  Branches     6762     6760       -2     
==========================================
+ Hits        35771    35860      +89     
+ Misses      38093    38028      -65     
  Partials     1462     1462              

☔ 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
@cd-bitwarden cd-bitwarden left a comment

Choose a reason for hiding this comment

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

Left a comment about something I'm curious about :)

@@ -1064,7 +1064,7 @@ public async Task MoveMany([FromBody] CipherBulkMoveRequestModel model)

[HttpPut("share")]
[HttpPost("share")]
public async Task PutShareMany([FromBody] CipherBulkShareRequestModel model)
public async Task<Dictionary<Guid, DateTime>> PutShareMany([FromBody] CipherBulkShareRequestModel model)
Copy link
Contributor

Choose a reason for hiding this comment

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

Hey! I was wondering if you looked into returning a list of CipherResponseModel similar to how PutShare works. Is there a reason why we wouldn't use the response model?

public async Task<CipherResponseModel> PutShare(Guid id, [FromBody] CipherShareRequestModel model)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@cd-bitwarden Returning the entire model seems a bit heavy-handed since we're only concerned with the revisionDate. Since this could involve many ciphers and collections I was hoping to keep it as lean as possible to avoid unnecessary lookups.

Copy link
Contributor
@cd-bitwarden cd-bitwarden May 30, 2025

Choose a reason for hiding this comment

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

My preference would be to return the full object as it exists in the database. From what I understand, we use this data to update the client-side cache, and any mismatch can trigger errors like "cipher is out of date." 🤔 I get your point about the amount of data being returned, but having the exact post-update cipher details from the database could help prevent these issues in the future. Might be worth getting a third opinion— @shane-melton , do you have any thoughts?

Copy link
Member

Choose a reason for hiding this comment

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

I think returning the CipherMiniResponseModel would be a happy medium between both and is an existing pattern we follow for other bulk/many endpoints. (See RestoreMany for example)

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh purrrrfect! 🐱 Best of both worlds! 😄 Thank you Shane for weighing in.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Hehe I was just looking at that. ;)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ready for re-review. ;)

Copy link

Copy link
Contributor
@cd-bitwarden cd-bitwarden left a comment

Choose a reason for hiding this comment

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

Thank you for making that change, everything looks great to me now -- and I tested locally and this fixes the issue I was having 🎉 I appreciate you!

@jaasen-livefront jaasen-livefront merged commit 2c4393c into main Jun 2, 2025
23 of 38 checks passed
@jaasen-livefront jaasen-livefront deleted the PM-22204 branch June 2, 2025 16:06
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
0