Skip to content

fix(e2ee): cache server public key during folder browsing - #18051

Open
xO-ox-ai wants to merge 1 commit into
nextcloud:masterfrom
xO-ox-ai:codex/cache-e2ee-server-key
Open

xO-ox-ai wants to merge 1 commit into
nextcloud:masterfrom
xO-ox-ai:codex/cache-e2ee-server-key

Conversation

@xO-ox-ai

Copy link
Copy Markdown

Repeatedly opening encrypted folders downloads the E2EE server public key on every entry. The server-key endpoint's default limit of six requests per ten minutes can therefore block normal folder browsing with HTTP 429.

Share successful, non-empty server public key responses in an in-memory cache for ten minutes, using a monotonic clock and synchronizing concurrent requests. Cache entries are scoped to the complete server URL and freshly fetched user certificate, so certificate changes trigger a new download. Failed and empty responses are not cached. User certificates are still fetched and verified on every check; folder metadata and signature validation remain unchanged. Resolve clients through ClientRepository and adapt the existing encrypted-folder integration test setup to the injected dependencies.

Validation on this branch:

  • Seven JVM tests passed, covering repeated entry, expiration, certificate changes, server/port isolation, failed/empty responses, concurrent requests, and certificate verification across inspector instances.
  • Kotlin formatting and Detekt for the changed files passed.
  • lintGplayDebug passed with no errors or warnings.
  • Android instrumented test Kotlin sources compiled successfully.
  • SpotBugs analysis of the changed production classes completed without analysis errors or missing classes; comparison with the base version found no new report identities.

AI disclosure: Codex (GPT-6) assisted with implementation, tests and analysis.

Reuse successful server public key responses for ten minutes, scoped to the server URL and current user certificate. Keep certificate verification on every entry and merge concurrent cache misses.

Assisted-by: Codex:GPT-6
Signed-off-by: Li Wei <caeser222000@sohu.com>

This branch has not been deployed

No deployments
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.

1 participant