Skip to content
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. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: properly return an error and use cache for public keys if possible #10590

Merged
merged 2 commits into from
Nov 18, 2024

Conversation

jvillafanez
Copy link
Member

Description

Return an error properly if we can't get the public keys.
In addition, ensure the new keys are cached to prevent unneeded hits to the "/hosting/discovery" endpoint, and log when we're requesting new keys.

Steps to reproduce the original issue seems unclear. WOPI requests are expected to come from the WOPI app (OnlyOffice in this case), and those should be the only ones triggering the issue, so it shouldn't be possible that a request to the discovery endpoint fails when the service is making a request. There might be some race condition, but it seems weird.

Related Issue

#10588

Motivation and Context

Wrong error value was causing a panic because we assume we got the keys although it wasn't true.

How Has This Been Tested?

Note that you can adjust the cache time of the public keys with COLLABORATION_APP_PROOF_DURATION

test 1

  1. Open and close a document with OnlyOffice
  2. Repeat step 1
    -> Only one "requesting new public keys" message is shown (at debug level). Step 2 won't trigger that message assuming the keys are still valid in the cache.

test 2

  1. Open and close a document with OnlyOffice
  2. Wait until COLLABORATION_APP_PROOF_DURATION goes by
  3. Repeat step 1
    -> "requesting new public keys" message (at debug level) will show twice

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Technical debt
  • Tests only (no source changes)

Checklist:

  • Code changes
  • Unit tests added
  • Acceptance tests added
  • Documentation ticket raised:

Copy link

update-docs bot commented Nov 18, 2024

Thanks for opening this pull request! The maintainers of this repository would appreciate it if you would create a changelog item based on your changes.

Copy link

sonarcloud bot commented Nov 18, 2024

@jvillafanez jvillafanez merged commit 29a24b4 into master Nov 18, 2024
4 checks passed
@jvillafanez jvillafanez deleted the collaboration_public_key_fix branch November 18, 2024 12:03
ownclouders pushed a commit that referenced this pull request Nov 18, 2024
fix: properly return an error and use cache for public keys if possible
@micbar micbar mentioned this pull request Nov 21, 2024
87 tasks
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