-
Notifications
You must be signed in to change notification settings - Fork 121
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
Hide secrets in Configuration #269
Comments
As a first step, I think we could support a Ideally, we could also use or combine the target type (from security package) and automatically mark the config as a secret. This will require some changes to be able to pass in the type in the interceptor chain. If we do add a Also, by the end of the chain, the plain value is needed to pass to the Converter. In this case, it is easier to manage, since this code is controlled by the implementation. |
A few other ideias to consider:
|
An interceptor handling secrets would probably run earlier, not later, so it could short-circuit the interception process. It could even throw an exception. A placeholder makes sense in concept but converters for secret types would have to be aware of the possibility. And it could get difficult if the secret was a clear password of type String or something string-like because any placeholder value would be indistinguishable from a clear password. Supporting clear passwords in configuration in any way is probably not a good security practice - at the least, passwords probably should be masked or encoded somehow. Interceptors can always make their own config values, so information could easily be lost if we try to subtype I don't have any answers, only more problems. :-) |
No worries, this was just to brainstorm some ideas :)
Yes, and what about expansion? Should expansion be done first or after? If you do it before, you are reading and exposing the secret to the next chain, that may be the secret interceptor or not to hide it. If you do it after, you require the plain String for expand. Unless, we also mark the
Yes. I agree. I'm not sure if there is an easy solution about this. While we could find information from the converted or injected type, no one can stop the user to use a simple String to do it, so I think we need to accept that this is going to happen.
We control how |
Trying to capture more detail: What do we want to prevent:
We can assume:
What can we do:
Questions:
|
That's a really good & clear summary. Given these assumptions, it seems to me that that the best possible course is as follows:
This solves the problem of how converters would deal with masked values (answer: they do not need to), how to filter secrets from iteration (answer: the user can either explicitly opt in to view secret values, or else catch the exception and note that the value can't be accessed), how to handle programmatic access (it'll give a runtime exception if the keys are locked, just the same as if validation or conversion would fail), and how to handle expansion of secrets (by putting the interceptor at the end, keys which reference secret keys are transitively protected). Injection of secret values could either be done with secrets unlocked, or else we could possibly introduce some opt-in annotation (though I think that's probably not necessary, since injecting a secret value seems like an explicit opt-in to me and is unlikely to be part of a general iteration/logging kind of case that this mechanism is designed to protect). I honestly can't think of any other viable solution. I think the usage of the runtime |
Thanks! Ok, let me work on a prototype and see how it looks like. |
…ment it without exposing secret keys.
…ment it without exposing secret keys.
…ment it without exposing secret keys.
Original issue from Quarkus:
quarkusio/quarkus#7442
But I think we should support this at the SmallRye Config level.
The text was updated successfully, but these errors were encountered: