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

feature: header encoder filter #3231

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

szuecs
Copy link
Member

@szuecs szuecs commented Sep 18, 2024

feature: header encoder filter #3230

Signed-off-by: Sandor Szücs <sandor.szuecs@zalando.de>
Signed-off-by: Sandor Szücs <sandor.szuecs@zalando.de>
@szuecs szuecs added the minor no risk changes, for example new filters label Sep 18, 2024

sNew, err := f.encoder.String(s)
if err != nil {
log.Errorf("Failed to encode %q: %v", s, err)

Check failure

Code scanning / CodeQL

Clear-text logging of sensitive information High

Sensitive data returned by HTTP request headers
flows to a logging call.

Copilot Autofix AI 2 months ago

To fix the problem, we should avoid logging the sensitive information directly. Instead, we can log a generic message indicating that an error occurred without including the sensitive data. This approach maintains the functionality of logging errors while protecting potentially sensitive information.

  • Modify the log statement on line 147 to remove the sensitive data (s).
  • Log a generic error message that does not include the sensitive data.
Suggested changeset 1
filters/builtin/header_encode.go

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/filters/builtin/header_encode.go b/filters/builtin/header_encode.go
--- a/filters/builtin/header_encode.go
+++ b/filters/builtin/header_encode.go
@@ -146,3 +146,3 @@
 	if err != nil {
-		log.Errorf("Failed to encode %q: %v", s, err)
+		log.Errorf("Failed to encode header value: %v", err)
 	}
EOF
@@ -146,3 +146,3 @@
if err != nil {
log.Errorf("Failed to encode %q: %v", s, err)
log.Errorf("Failed to encode header value: %v", err)
}
Copilot is powered by AI and may make mistakes. Always verify output.
Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
minor no risk changes, for example new filters
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant