Skip to content

Conversation

@nick-livefront
Copy link
Contributor

@nick-livefront nick-livefront commented Oct 9, 2024

🎟️ Tracking

PM-11249

📔 Objective

Current Issue: When an attachment is added or deleted, web/browser clients are not being updated of the change.

Cause: The logic within the CoreSyncService on the client side uses the cipher revision date to determine if a sync is needed. Server side the cipher revision date isn't updated.

Proposed Fix:

  • Update the revision date on the cipher if an attachment is added or deleted and store in the DB
  • In order to support this, the delete attachment endpoint needs to return the cipher as clients will need to know of the new revision date on the cipher.
  • client PR for the parallel changes to support this.

📸 Screenshots

Before After
attachments-before.mov
attachments-after.mov

🦮 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 a review from a team as a code owner October 9, 2024 18:20
@shane-melton
Copy link
Member

shane-melton commented Oct 9, 2024

❓ Are you still able to modify the cipher after uploading an attachment? I'm worried that we don't return the updated cipher in the attachment endpoint so the cipher.revisionDate will be stale client side, which will prevent users from making changes until they manually re-sync or refresh their vault (on the client that uploaded the attachment).

@codecov
Copy link

codecov bot commented Oct 9, 2024

Codecov Report

Attention: Patch coverage is 0% with 15 lines in your changes missing coverage. Please review.

Project coverage is 44.31%. Comparing base (a9a1230) to head (72fe323).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...re/Vault/Services/Implementations/CipherService.cs 0.00% 9 Missing ⚠️
...e/Vault/Models/Data/DeleteAttachmentReponseData.cs 0.00% 5 Missing ⚠️
src/Api/Vault/Controllers/CiphersController.cs 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4873      +/-   ##
==========================================
- Coverage   44.32%   44.31%   -0.01%     
==========================================
  Files        1482     1483       +1     
  Lines       68376    68388      +12     
  Branches     6172     6172              
==========================================
  Hits        30307    30307              
- Misses      36761    36773      +12     
  Partials     1308     1308              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@nick-livefront
Copy link
Contributor Author

nick-livefront commented Oct 9, 2024

❓ Are you still able to modify the cipher after uploading an attachment? I'm worried that we don't return the updated cipher in the attachment endpoint so the cipher.revisionDate will be stale client side, which will prevent users from making changes until they manually re-sync or refresh their vault (on the client that uploaded the attachment).

Nice catch, I only tested on the client that received the update which in turn would have the updated cipher.

On the same client you are not able to. 🤔

Screen.Recording.2024-10-09.at.1.32.52.PM.mov

@github-actions
Copy link
Contributor

github-actions bot commented Oct 9, 2024

Logo
Checkmarx One – Scan Summary & Detailsfcd6880d-cbd0-45e0-a445-4bb8ac2be417

New Issues (12)

Checkmarx found the following issues in this Pull Request

Severity Issue Source File / Package Checkmarx Insight
MEDIUM CSRF /src/Billing/Controllers/PayPalController.cs: 66
detailsMethod PostIpn at line 66 of /src/Billing/Controllers/PayPalController.cs gets a parameter from a user request from Body. This parameter value flow...
Attack Vector
MEDIUM CSRF /src/Api/Vault/Controllers/CiphersController.cs: 1100
detailsMethod DeleteAttachment at line 1100 of /src/Api/Vault/Controllers/CiphersController.cs gets a parameter from a user request from id. This paramete...
Attack Vector
MEDIUM CSRF /src/Api/Vault/Controllers/CiphersController.cs: 1100
detailsMethod DeleteAttachment at line 1100 of /src/Api/Vault/Controllers/CiphersController.cs gets a parameter from a user request from id. This paramete...
Attack Vector
MEDIUM CSRF /src/Api/Vault/Controllers/CiphersController.cs: 1100
detailsMethod DeleteAttachment at line 1100 of /src/Api/Vault/Controllers/CiphersController.cs gets a parameter from a user request from DeleteAttachment....
Attack Vector
MEDIUM CSRF /src/Api/Vault/Controllers/CiphersController.cs: 1023
detailsMethod PostAttachment at line 1023 of /src/Api/Vault/Controllers/CiphersController.cs gets a parameter from a user request from id. This parameter ...
Attack Vector
MEDIUM CSRF /src/Api/Vault/Controllers/CiphersController.cs: 997
detailsMethod PostFileForExistingAttachment at line 997 of /src/Api/Vault/Controllers/CiphersController.cs gets a parameter from a user request from id. T...
Attack Vector
MEDIUM CSRF /src/Api/Vault/Controllers/CiphersController.cs: 1046
detailsMethod PostAttachmentAdmin at line 1046 of /src/Api/Vault/Controllers/CiphersController.cs gets a parameter from a user request from id. This param...
Attack Vector
MEDIUM Privacy_Violation /src/Core/AdminConsole/OrganizationAuth/UpdateOrganizationAuthRequestCommand.cs: 84
detailsMethod UpdateAsync at line 84 of /src/Core/AdminConsole/OrganizationAuth/UpdateOrganizationAuthRequestCommand.cs sends user information outside the...
Attack Vector
MEDIUM Privacy_Violation /src/Core/NotificationHub/NotificationHubPushNotificationService.cs: 195
detailsMethod PushAuthRequestAsync at line 195 of /src/Core/NotificationHub/NotificationHubPushNotificationService.cs sends user information outside the a...
Attack Vector
LOW Log_Forging /src/Api/Auth/Controllers/AuthRequestsController.cs: 87
detailsMethod PostAdminRequest at line 87 of /src/Api/Auth/Controllers/AuthRequestsController.cs gets user input from element model. This element’s value ...
Attack Vector
LOW Log_Forging /src/Api/Auth/Controllers/AuthRequestsController.cs: 75
detailsMethod Post at line 75 of /src/Api/Auth/Controllers/AuthRequestsController.cs gets user input from element model. This element’s value flows throug...
Attack Vector
LOW Missing_CSP_Header /src/Core/MailTemplates/Handlebars/AdminConsole/DomainClaimedByOrganization.html.hbs: 7
detailsA Content Security Policy is not explicitly defined within the web-application.
Attack Vector
Fixed Issues (28)

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

Severity Issue Source File / Package
MEDIUM CSRF /src/Api/Tools/Controllers/OrganizationExportController.cs: 53
MEDIUM CSRF /src/Admin/AdminConsole/Controllers/OrganizationsController.cs: 375
MEDIUM CSRF /src/Api/AdminConsole/Controllers/GroupsController.cs: 80
MEDIUM CSRF /src/Api/AdminConsole/Controllers/GroupsController.cs: 121
MEDIUM CSRF /src/Api/AdminConsole/Public/Controllers/PoliciesController.cs: 46
MEDIUM CSRF /src/Api/AdminConsole/Public/Controllers/PoliciesController.cs: 65
MEDIUM CSRF /src/Api/Auth/Controllers/AccountsController.cs: 470
MEDIUM CSRF /src/Api/Vault/Controllers/CiphersController.cs: 220
MEDIUM CSRF /src/Api/Vault/Controllers/CiphersController.cs: 220
MEDIUM CSRF /src/Api/Vault/Controllers/CiphersController.cs: 1100
MEDIUM CSRF /src/Api/Vault/Controllers/CiphersController.cs: 173
MEDIUM CSRF /src/Api/Vault/Controllers/CiphersController.cs: 533
MEDIUM CSRF /src/Api/Vault/Controllers/CiphersController.cs: 533
MEDIUM CSRF /src/Api/Vault/Controllers/CiphersController.cs: 1100
MEDIUM Privacy_Violation /src/Api/Auth/Models/Request/Accounts/SetPasswordRequestModel.cs: 28
LOW Log_Forging /src/Api/Billing/Controllers/OrganizationBillingController.cs: 238
LOW Log_Forging /src/Api/Billing/Controllers/OrganizationBillingController.cs: 238
LOW Log_Forging /src/Api/Billing/Controllers/OrganizationBillingController.cs: 238
LOW Log_Forging /src/Api/Billing/Controllers/ProviderBillingController.cs: 104
LOW Log_Forging /src/Api/Billing/Controllers/ProviderBillingController.cs: 104
LOW Log_Forging /src/Api/Billing/Controllers/ProviderBillingController.cs: 104
LOW Log_Forging /src/Billing/Controllers/RecoveryController.cs: 38
LOW Log_Forging /src/Billing/Controllers/RecoveryController.cs: 38
LOW Log_Forging /src/Api/Vault/Controllers/CiphersController.cs: 173
LOW Log_Forging /src/Billing/Controllers/StripeController.cs: 164
LOW Log_Forging /src/Billing/Controllers/StripeController.cs: 164
LOW Log_Forging /src/Api/Auth/Controllers/AccountsController.cs: 261
LOW Log_Forging /src/Api/Auth/Controllers/AccountsController.cs: 381

@nick-livefront nick-livefront marked this pull request as draft October 11, 2024 16:42
@nick-livefront
Copy link
Contributor Author

Marking this a draft as I have yet to track down all of the necessary changes on server and client side. Priorities have changed so I'll be taking up some other work in the mean time.

See the ticket for more details about solutioning these scenarios.

@nick-livefront
Copy link
Contributor Author

@shane-melton I order to support this change for deleting an attachment, the UI needed to know the updated revision timestamp. I added logic to return the updated cipher to both the client and here 13acab5

@nick-livefront nick-livefront marked this pull request as ready for review October 28, 2024 19:20
Copy link
Contributor

@gbubemismith gbubemismith left a comment

Choose a reason for hiding this comment

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

Changes look good

@nick-livefront nick-livefront marked this pull request as draft November 6, 2024 20:02
@nick-livefront
Copy link
Contributor Author

Moving to a draft as this work is being tabled for a couple weeks why we wait for the extension refresh to roll out.

@nick-livefront nick-livefront marked this pull request as ready for review January 3, 2025 19:20
@nick-livefront nick-livefront merged commit 4e1e514 into main Jan 28, 2025
53 checks passed
@nick-livefront nick-livefront deleted the vault/pm-11249/attachment-cipher-date branch January 28, 2025 15:49
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.

4 participants