Skip to content

Commit dafe4ab

Browse files
authored
Merge pull request akabarki76#18 from akabarki76/alert-autofix-23
Potential fix for code scanning alert no. 23: Log entries created from user input
2 parents adc3558 + b484b56 commit dafe4ab

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)