feat: support storing, retrieving and refreshing encrypted secrets at account or asset level#2236
Open
nhoening wants to merge 26 commits into
Open
feat: support storing, retrieving and refreshing encrypted secrets at account or asset level#2236nhoening wants to merge 26 commits into
nhoening wants to merge 26 commits into
Conversation
… account or asset level Signed-off-by: Nicolas Höning <nicolas@seita.nl>
Signed-off-by: Nicolas Höning <nicolas@seita.nl>
…on initialiation there Signed-off-by: Nicolas Höning <nicolas@seita.nl>
Flix6x
requested changes
Jun 14, 2026
Flix6x
left a comment
Member
There was a problem hiding this comment.
Probably some discussion points before proceeding?
Flix6x
reviewed
Jun 15, 2026
Flix6x
left a comment
Member
There was a problem hiding this comment.
I was also thinking that this PR might need CLI logic to rotate the FLEXMEASURES_SECRETS_ENCRYPTION_KEY key, updating secrets accordingly. That is, decrypting secrets that were encrypted using the old key, and encrypting them with the new key.
Member
Author
I would suggest doing a follow-up PR for that. |
…ove plugin docs section Signed-off-by: Nicolas Höning <nicolas@seita.nl>
Signed-off-by: Nicolas Höning <nicolas@seita.nl>
Signed-off-by: Nicolas Höning <nicolas@seita.nl>
Signed-off-by: Nicolas Höning <nicolas@seita.nl>
Signed-off-by: Nicolas Höning <nicolas@seita.nl>
Signed-off-by: Nicolas Höning <nicolas@seita.nl>
Signed-off-by: Nicolas Höning <nicolas@seita.nl>
Flix6x
requested changes
Jun 22, 2026
| "--secret", | ||
| "secret_path", | ||
| required=True, | ||
| help="Add/edit this secret. Follow up with a dot-separated path.", |
Member
There was a problem hiding this comment.
What does the dot-separated path do?
Co-authored-by: Felix Claessen <30658763+Flix6x@users.noreply.github.com> Signed-off-by: Nicolas Höning <iam@nicolashoening.de>
Co-authored-by: Felix Claessen <30658763+Flix6x@users.noreply.github.com> Signed-off-by: Nicolas Höning <iam@nicolashoening.de>
Co-authored-by: Felix Claessen <30658763+Flix6x@users.noreply.github.com> Signed-off-by: Nicolas Höning <iam@nicolashoening.de>
Co-authored-by: Felix Claessen <30658763+Flix6x@users.noreply.github.com> Signed-off-by: Nicolas Höning <iam@nicolashoening.de>
Co-authored-by: Felix Claessen <30658763+Flix6x@users.noreply.github.com> Signed-off-by: Nicolas Höning <iam@nicolashoening.de>
Co-authored-by: Felix Claessen <30658763+Flix6x@users.noreply.github.com> Signed-off-by: Nicolas Höning <iam@nicolashoening.de>
Co-authored-by: Felix Claessen <30658763+Flix6x@users.noreply.github.com> Signed-off-by: Nicolas Höning <iam@nicolashoening.de>
Co-authored-by: Felix Claessen <30658763+Flix6x@users.noreply.github.com> Signed-off-by: Nicolas Höning <iam@nicolashoening.de>
Co-authored-by: Felix Claessen <30658763+Flix6x@users.noreply.github.com> Signed-off-by: Nicolas Höning <iam@nicolashoening.de>
Co-authored-by: Felix Claessen <30658763+Flix6x@users.noreply.github.com> Signed-off-by: Nicolas Höning <iam@nicolashoening.de>
Co-authored-by: Felix Claessen <30658763+Flix6x@users.noreply.github.com> Signed-off-by: Nicolas Höning <iam@nicolashoening.de>
Signed-off-by: Nicolas Höning <nicolas@seita.nl>
Signed-off-by: Nicolas Höning <nicolas@seita.nl>
Signed-off-by: Nicolas Höning <nicolas@seita.nl>
Signed-off-by: Nicolas Höning <nicolas@seita.nl>
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.
Description
With this PR, secrets like refresh and access tokens can be stored on account or asset level in the db (encrypted).
This allows to stop saving them in configuration files as-is. This PR also adds supporting logic which manages token refresh cycles.
secretsfield on account and asset levelflexmeasures edit secretandflexmeasures delete secretdocumentation/changelog.rstLook & Feel
View of secrets shown in the UI:
How to test
I tested this in a plugin which connects to 3rd party platforms, by adding code which integrated with these new fields and utils. I added a
loginCLI command there, plusget_3rdparty_platform_access_token()helpers and explicit warnigns and errors.Further Improvements