Skip to content
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

Redact Authorization header for --verbose logging to avoid credential leaks #49

Open
scothis opened this issue Jul 20, 2023 · 0 comments

Comments

@scothis
Copy link

scothis commented Jul 20, 2023

Is your feature request related to a problem? Please describe.

The --verbose flag prints details for HTTP requests made by the cli, including the Authorization header. This header contains credentials use the authorize the request. A malicious user who has access to the logs could use that credential to impersonate the original account.

This behavior is particularly problematic when the pivnet-cli is used in a CI environment that captures and persists logs, which are often visible to multiple individuals who are not authorized to have the credential.

Describe the solution you'd like

Auth credentials should never be logged in a way that can be observed by a third-party and then refused maliciously. The content of the Authorization header should be redacted in the log output. In the case where the value is the JWT bearer token, the signature can be redacted so that the token is invalidated while the user can still inspect the header and payload content.

If and when logging the credential is desirable, the user should opt-in to that behavior with a setting that is clearly labeled as "unsafe" or "dangerous".

Describe alternatives you've considered

Many CI system attempt to redact known credentials from the log, however, the tokens used by Pivnet to authorize requests are generated and not known to the CI system as a secret.

A user could manually apply a grep filter to remove this value, but that is a high burden to place on every pivnet-cli invocation. It is also fragile as the format of the output may change again exposing the credential.

Additional context

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant