WIP Experiment in handling Sensitive keys #6595
Closed
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.
Nomad has sensitive keys (e.g. ACL/Vault/Consul tokens) that Nomad ought not to log or expose in HTTP. One approach is to wrap the values in types such that they get redacted when logged.
Here, I attempt this approach to report early feedback and finding.
In this implementation, I introduce
Sensitive
string wrapper that is automatically redacted when logged and serialized in json but not when persisted in client state or RPC responses. To access the value, one must use thePlaintext()
method to access value.My experience has been relatively mixed:
encoding/json
while agent http handler and persistence usesugorji/go
for serialization.Though the approach is neat, given that we pass secrets around in RPC, I am not fully convinced this is useful as it is.
Some possible next steps:
Secret
level for values that should only be stored in memory and never persisted or returned in API/RPC.