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

GitHub authentication headers can leak to logs #10139

Closed
Frassle opened this issue Jul 14, 2022 · 2 comments · Fixed by #10140
Closed

GitHub authentication headers can leak to logs #10139

Frassle opened this issue Jul 14, 2022 · 2 comments · Fixed by #10140
Assignees
Labels
area/logging Logs and diagnostics impact/security kind/bug Some behavior is incorrect or out of spec resolution/fixed This issue was fixed
Milestone

Comments

@Frassle
Copy link
Member

Frassle commented Jul 14, 2022

What happened?

When installing a Pulumi plugin (custom provider) that's hosted on a private Github repository, a Github Token is required. That token is inserted as a header in the GET query for Github to authenticate the request.

However, if the CLI is set to verbosity level is set to 9 or above and the plugin hasn't been installed yet, then plugins.go will leak the Github token into the logs as part of logging the request headers.

Steps to reproduce

Download a plugin from github with GITHUB_TOKEN set.

Expected Behavior

Log messages to not include the actual GITHUB_TOKEN.

Actual Behavior

Log message includes the token:

I0713 14:54:46.243492    8779 plugins.go:750] plugin install request headers: map[Accept:[application/json] Authorization:[token ghp_Ys1f<REDACTED>] User-Agent:[pulumi-cli/1 (; linux)]]

Versions used

3.35

Additional context

This was introduced in #9185.

We should either blind the Authorization before writing to logs, or move this to log level 11 which intentionally leaks credentials to help with debugging.

Contributing

Vote on this issue by adding a 👍 reaction.
To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).

@Frassle Frassle added kind/bug Some behavior is incorrect or out of spec needs-triage Needs attention from the triage team impact/security area/logging Logs and diagnostics and removed needs-triage Needs attention from the triage team labels Jul 14, 2022
@Frassle Frassle self-assigned this Jul 14, 2022
@Frassle Frassle added this to the 0.75 milestone Jul 14, 2022
Frassle added a commit that referenced this issue Jul 14, 2022
Frassle added a commit that referenced this issue Jul 14, 2022
* Only log request/response headers at level 11

Fixes #10139

* Add to CHANGELOG
@pulumi-bot pulumi-bot added the resolution/fixed This issue was fixed label Jul 14, 2022
@aureq
Copy link
Member

aureq commented Jul 15, 2022

@Frassle I'm reopening the issue as I think we bring added clarity to the end-user.

One thing that wasn't obvious and as it was reported by @contrarianchris is that setting the log level doesn't mean the user knows the implications of doing so.

As a possible improvements, I think the CLI should display a clear (yellow colored?) warning when the log level is 10 or above, and clear state that such level may reveal sensitive information such as token and request headers.

I also think we should update our documentation https://www.pulumi.com/docs/support/troubleshooting/#verbose-logging to reflect the changes as well.

These logs may include sensitive information that is provided from your execution environment to your cloud provider (and which Pulumi may not even itself be aware of) so be careful to audit before sharing.

@aureq aureq reopened this Jul 15, 2022
@aureq aureq removed the resolution/fixed This issue was fixed label Jul 15, 2022
@Frassle
Copy link
Member Author

Frassle commented Jul 15, 2022

I also think we should update our documentation https://www.pulumi.com/docs/support/troubleshooting/#verbose-logging to reflect the changes as well.

Yup Luke had also made this comment on the PR and I'd made a note to myself to change that today, but I do like the explicit warning at startup as well. I'll add that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/logging Logs and diagnostics impact/security kind/bug Some behavior is incorrect or out of spec resolution/fixed This issue was fixed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants