Add fallback routines for empty secret cases#31499
Merged
CarlSchwan merged 5 commits intomasterfrom Oct 17, 2022
Merged
Conversation
Member
Author
|
Test results when having an instance without a secret and adding one afterwards:
|
Member
Author
|
Retested with follow up commits:
|
CarlSchwan
approved these changes
Mar 10, 2022
Member
CarlSchwan
left a comment
There was a problem hiding this comment.
Code looks good and I tested it manually and I didn't get logged when moving from a config without secret to a config.php with a secret
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Signed-off-by: Julius Härtl <jus@bitgrid.net>
57a7255 to
a6796b4
Compare
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
Merged
Merged
Merged
Merged
9 tasks
Member
|
Should we merge it without the migration path and just add the warning from #31492 instead? It's better than the current state |
Co-authored-by: Joas Schilling <213943+nickvergessen@users.noreply.github.com> Signed-off-by: Carl Schwan <carl@carlschwan.eu>
Merged
ArtificialOwl
approved these changes
Sep 16, 2022
come-nc
approved these changes
Sep 19, 2022
Member
|
/backport to stable25 |
Member
|
Manual backport #35605 |
6 tasks
raboof
added a commit
to raboof/server
that referenced
this pull request
Mar 6, 2025
Before this patch, when decrypting a value without using a password, it would call `decryptWithoutSecret` with the system `secret` as `password`. When this fails, it would retry with an empty string as `password`. This has the practical disadvantage that it can lead to confusing error messages. For example, when using the TOTP app, when the system `secret` is misconfigured, the first invocation will throw a sensible `HMAC does not match.` error, but then it is retried and the retry throws a `Hash_hkdf(): Argument nextcloud#2 ($key) cannot be empty` error causing confusion (e.g. https://help.nextcloud.com/t/hash-hkdf-argument-2-key-cannot-be-empty/192556). Of course this fallback to using an empty string is likely part of some sort of graceful migration from the days when the secret could be empty (e.g. nextcloud#34012, nextcloud#31499). However, taking a wider perspective, such 'fallback logic' in security-critical areas makes things more complex, which is a risk. It's not quite the same scenario, but Heartbleed does come to mind. For this reason, rather than a 'surgical' improvement for the particular case encountered above (increasing complexity further), I think it'd be worth to start considering removing this fallback entirely (perhaps in v32.0.0?) - hence this conversation-starter PR. Signed-off-by: Arnout Engelen <arnout@bzzt.net>
8 tasks
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.
Make sure to keep authentication working when an instance has been setup without a secret after adding the secret manually afterwards.
Provides a possible migration path for #31492
ToDo