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

Update logging to redact AccessToken if provided at commandline #50

Merged
merged 1 commit into from
Nov 15, 2018

Conversation

HowardWolosky
Copy link
Member

All API accessing methods allow users to provide an AccessToken to be used
for the duration of that API call. The problem with that is that the
command is also logged by default, which means that the AccessToken value
might be logged in plain text to the log file.

To fix this, Write-InvocationLog has been modified in a few ways:

  • Can now redact the value of specified parameters, or exclude the parameter altogether.
  • AccessToken has been configured to always be redacted, and
    NoStatus has been configured to always be excluded (to avoid noise)
  • Instead of logging the originally invoked line, as well as the individual
    values of the parameters, this now logs a single line with a modified version
    of the invocation with the substitution of parameter values performed in-place.
  • The DisableParameterLogging configuation value has been removed, as we're no
    longer taking up additional verbose space (we're always logging a single line), and
    we have to process the parameters anyway to ensure that we're excluding/redacting
    the necessary parameters, meaning that we can't log the invoked line no matter what.

All API accessing methods allow users to provide an AccessToken to be used
for the duration of that API call.  The problem with that is that the
command is also logged by default, which means that the AccessToken value
might be logged in plain text to the log file.

To fix this, `Write-InvocationLog` has been modified in a few ways:
  * Can now redact the value of specified parameters, or exclude the parameter altogether.
  * `AccessToken` has been configured to _always_ be redacted, and
    `NoStatus` has been configured to _always_ be excluded (to avoid noise)
  * Instead of logging the originally invoked line, as well as the individual
    values of the parameters, this now logs a single line with a modified version
	of the invocation with the substitution of parameter values performed in-place.
  * The `DisableParameterLogging` configuation value has been removed, as we're no
    longer taking up additional verbose space (we're always logging a single line), and
	we have to process the parameters anyway to ensure that we're excluding/redacting
	the necessary parameters, meaning that we can't log the invoked line no matter what.
@HowardWolosky HowardWolosky merged commit c6835f4 into microsoft:master Nov 15, 2018
@HowardWolosky HowardWolosky deleted the logging branch November 15, 2018 23:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant