Skip to content

Commit b484b56

Browse files
Potential fix for code scanning alert no. 23: Log entries created from user input
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
1 parent adc3558 commit b484b56

File tree

1 file changed

+4
-0
lines changed
  • third-party/github.com/letsencrypt/boulder/web

1 file changed

+4
-0
lines changed

third-party/github.com/letsencrypt/boulder/web/context.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,10 @@ func (th *TopHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
141141
realIP = "0.0.0.0"
142142
}
143143

144+
// Sanitize the realIP value to remove newline and carriage return characters.
145+
realIP = strings.ReplaceAll(realIP, "\n", "")
146+
realIP = strings.ReplaceAll(realIP, "\r", "")
147+
144148
userAgent := r.Header.Get("User-Agent")
145149

146150
logEvent := &RequestEvent{

0 commit comments

Comments
 (0)