Repository navigation
fix(security): keep stored secrets and feed tokens out of the clear - #9944
Merged
Merged
Conversation
Webhook signing secrets and the secret values of a consumer's authorization configuration are stored encrypted with Nextcloud's ICrypto and opened when read from the store; a secret that cannot be decrypted is never used to send an unsigned delivery. Calendar feed tokens are stored as their SHA-256 and looked up by it, and a token minted without a lifetime takes a configurable default (365 days). The ProtectStoredSecrets repair step encrypts existing secrets and hashes existing tokens in place, giving never-expiring tokens the default lifetime, so subscribed URLs keep working until then. Assisted-by: ClaudeCode:claude-opus-5-5
A sealed secret that cannot be decrypted now reads as absent (logged) instead of as its ciphertext, so a consumer api key or HMAC secret cannot be matched with the stored value. A webhook secret that cannot be opened reads as a sealed marker, so the delivery is refused, not sent unsigned. Assisted-by: ClaudeCode:claude-opus-5-5
Assisted-by: ClaudeCode:claude-opus-5-5
Assisted-by: ClaudeCode:claude-opus-5-5
Contributor
Quality Report — ConductionNL/openregister @
|
| Check | PHP | Vue | Security | License | Tests |
|---|---|---|---|---|---|
| lint | ✅ | ||||
| phpcs | ❌ | ||||
| phpmd | ❌ | ||||
| psalm | ❌ | ||||
| phpstan | ❌ | ||||
| phpmetrics | ✅ | ||||
| eslint | ❌ | ||||
| stylelint | ✅ | ||||
| build | ✅ | ||||
| check-specs | ✅ | ||||
| test-l10n | ❌ | ||||
| test-l10n-parity | ❌ | ||||
| format | ❌ | ||||
| check-schema-l10n | ✅ | ||||
| test-newman-route-ratchet | ✅ | ||||
| composer | ✅ | ✅ 169/169 | |||
| npm | ✅ | ✅ 639/639 | |||
| app:check-code | ⏭️ | ||||
| info.xml | ✅ | ||||
| REUSE | ✅ | ||||
| lockfile sync | ✅ | ||||
| PHPUnit | ❌ 56571/56779 · 27 skipped (worst of 4 legs: PHP 8.3, NC stable32, pgsql; counts from 4 of 8 legs) | ||||
| Newman | ❌ | ||||
| Playwright | ❌ 237/324 · 5 skipped · 164 did not run | ||||
| Hydra gates | ❌ |
Quality workflow — 2026-11-13 19:04 UTC
Download the full PDF report from the workflow artifacts.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
Secrets that were stored in clear are now encrypted at rest with Nextcloud's
ICrypto, and calendar feed tokens are stored as hashes.Webhook and consumer secrets
Db\Support\SecretAtRestseals a value asorenc:v1:followed by theICrypto::encrypt()output, and opens it again. Sealing is idempotent. A value stored before this change still reads as it is. A value that cannot be decrypted is logged and never used as its ciphertext: a consumer secret reads as absent, so an api key or HMAC key built on it is refused, and a webhook secret reads as a sealed marker, so the delivery is refused.WebhookMapperseals the signing secret on insert and update and opens it when it maps a row, soWebhookServiceand the signing code receive the plain secret as before.WebhookRequestOptions::headers()refuses to build a delivery when the secret is still sealed, instead of sending it unsigned.MapperWiringpasses the helper in.ConsumerMapperdoes the same for the secret keys ofauthorizationConfiguration:apiKey,publicKey(the shared secret for HS* algorithms),secret,client_secret,password,private_keyandtoken. Lookups such asfindByApiKey, JWT verification and grant binding see plain values. The consumers API now returns the sealed form of those keys instead of the plain one.Calendar feed tokens
CalendarFeedTokenServicestoressha256(token)andresolve()looks the token up by that hash. The token and its URL are handed out once, in the mint response.listForUser()now returnstoken: nullandurl: null, because only the hash is kept.ttlSecondstakes the default lifetime from app configopenregister/calendar_feed_token_ttl_seconds. The default is 365 days, and0means no expiry, which an administrator can choose.Repair step
ProtectStoredSecrets(post-migration, idempotent)docs/Features/webhooks.mdsays how the secret is stored and what happens when it cannot be decrypted.Notes for the reviewer
ICryptovalue in Nextcloud. Deliveries for an affected webhook stop until its secret is set again.Tests
SecretsAtRestTestcovers:CalendarFeedTokenServiceGuardsTestandCalendarFeedTokenServiceTest: the mint stores the hash and returns the token, the lookup goes by the hash, the default lifetime applies and is configurable (0 means no expiry), and the listing no longer carries the token or URL.MapperRegistrarTestgolden:WebhookMappernow also asks forICrypto.The new cases fail on the base.
What ran
phpunit tests/Unit/Service/Calendar(119 OK),tests/Unit/Repair(328 OK),SecretsAtRestTest,MapperRegistrarTest, the webhook service tests (includingWebhookServiceTest143 OK),ConsumersControllerTest, theAuthorizationService*and JWT tests,ConsumerMapperSourceApiKeyGoldenTest,TokenGrantTestandTokenResolverTest: all OKF08ContractBindingsEntryTest,HubClassesAreReachedThroughInterfacesTest,FactoryTablesMatchConstructorsTest,TestMethodsCanFailTest: all OKphp -l,phpcsandphpstanon the touched files: no new findings. Twoproperty.onlyWrittenfindings onWebhookMapperlines this change does not touch are inherited.AI-assisted: prepared with Claude Code (claude-opus-5-5); reviewed by a maintainer before merge.