Skip to content

Potential fix for code scanning alert no. 1: Clear-text logging of sensitive information#55

Closed
ilyabrin wants to merge 1 commit into
releasefrom
alert-autofix-2
Closed

Potential fix for code scanning alert no. 1: Clear-text logging of sensitive information#55
ilyabrin wants to merge 1 commit into
releasefrom
alert-autofix-2

Conversation

@ilyabrin
Copy link
Copy Markdown
Owner

Potential fix for https://github.com/ilyabrin/disk/security/code-scanning/1

To fix the problem, we need to ensure that sensitive information in HTTP headers is always obfuscated or omitted before being logged. Specifically, in the LogRequest method, we should always log the sanitized value for each header, never the original value. If a value is sanitized (i.e., replaced with asterisks or masked), we log the sanitized value; otherwise, we log the original value only if it is not sensitive. The misleading logic that logs [sanitized] when the value is not sanitized should be corrected. Additionally, we should review the initial request line to ensure it does not include sensitive information (though method and URL are generally safe). The changes are limited to the LogRequest method in logger.go.

Required changes:

  • Update the header logging loop in LogRequest to always log the sanitized value, never the original.
  • Remove the misleading [sanitized] log line.
  • No new imports or method definitions are needed.

Suggested fixes powered by Copilot Autofix. Review carefully before merging.

…nsitive information

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@ilyabrin ilyabrin closed this Jul 28, 2025
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.

1 participant