-
Notifications
You must be signed in to change notification settings - Fork 0
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
feat: enhance DoImageMultiPartUpload with detailed logging and bounda… #268
Conversation
req.Header.Add("Content-Type", contentTypeHeader) | ||
|
||
c.Sugar.Debugw("Request headers before auth", | ||
zap.Any("headers", req.Header), |
Check failure
Code scanning / CodeQL
Clear-text logging of sensitive information High
Sensitive data returned by HTTP request headers
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI about 1 month ago
To fix the problem, we should avoid logging the entire HTTP request headers directly. Instead, we can selectively log only the non-sensitive parts of the headers or obfuscate sensitive information before logging. In this case, we will remove the logging of the entire headers and only log the content type header, which is less likely to contain sensitive information.
- Remove the logging of the entire request headers.
- Log only the content type header, which is less likely to contain sensitive information.
- Ensure that no sensitive information is logged in clear text.
-
Copy modified line R488 -
Copy modified lines R493-R494
@@ -487,4 +487,3 @@ | ||
|
||
c.Sugar.Debugw("Request headers before auth", | ||
zap.Any("headers", req.Header), | ||
c.Sugar.Debugw("Request content type before auth", | ||
zap.String("contentType", contentTypeHeader)) | ||
@@ -493,4 +492,4 @@ | ||
|
||
c.Sugar.Debugw("Request headers after auth", | ||
zap.Any("headers", req.Header)) | ||
c.Sugar.Debugw("Request content type after auth", | ||
zap.String("contentType", req.Header.Get("Content-Type"))) | ||
|
|
||
(*c.Integration).PrepRequestParamsAndAuth(req) | ||
|
||
c.Sugar.Debugw("Request headers after auth", | ||
zap.Any("headers", req.Header)) |
Check failure
Code scanning / CodeQL
Clear-text logging of sensitive information High
Sensitive data returned by HTTP request headers
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI about 1 month ago
To fix the problem, we should avoid logging sensitive information contained in the headers. Instead of logging all headers, we can selectively log non-sensitive headers or obfuscate sensitive values before logging. This ensures that sensitive information is not exposed in the logs.
- Identify and filter out sensitive headers before logging.
- Obfuscate or mask sensitive values if they need to be logged for debugging purposes.
- Update the logging statements to reflect these changes.
-
Copy modified lines R494-R502 -
Copy modified line R504
@@ -493,4 +493,13 @@ | ||
|
||
// Filter out sensitive headers before logging | ||
safeHeaders := make(http.Header) | ||
for k, v := range req.Header { | ||
if strings.ToLower(k) == "authorization" || strings.ToLower(k) == "cookie" { | ||
safeHeaders[k] = []string{"[REDACTED]"} | ||
} else { | ||
safeHeaders[k] = v | ||
} | ||
} | ||
c.Sugar.Debugw("Request headers after auth", | ||
zap.Any("headers", req.Header)) | ||
zap.Any("headers", safeHeaders)) | ||
|
…ry handling
Change
Type of Change
Please DELETE options that are not relevant.
Checklist