DXCDT-335: Store access token in OS keyring #645
Merged
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.
🔧 Changes
Up until now, the Auth0 access token was stored in a local JSON config file. While the token is short-lived, it does possess a wide range of scopes and could be problematic if exposed. A theoretical attack vector could be a malicious package/process traversing a filesystem in hopes of finding an Auth0 CLI configuration file with a valid access token.
Similarly to other secrets in the Auth0 CLI, it is propsed to store the access token in the OS keyring. However, there are OS-specific size limits that we need to be aware of. In order to integrate nicely across all platforms, we are sharding the access token across a number of separate secrets in the keyring.
Not all OSs have a keyring installed by default, notably bare linux distros. In these cases, we continue to write the access token to the local configuration file directly. Presumably, these cases would most likely occur in CI or automated jobs where the process is short-lived and token discarded shortly after use.
Notably, the Github CLI stores their Oauth tokens in a local JSON configuration file much like the current implementation. However, the community has an outstanding request to store in the keyring, much like this PR is attempting to accomplish.
📚 References
🔬 Testing
api
invocations📝 Checklist