Skip to content

Add LogSanitizer for tainted values in log statements#1864

Merged
stiv03 merged 1 commit into
masterfrom
fix/log-injection-sanitizer
Jun 30, 2026
Merged

Add LogSanitizer for tainted values in log statements#1864
stiv03 merged 1 commit into
masterfrom
fix/log-injection-sanitizer

Conversation

@stiv03

@stiv03 stiv03 commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

LMCROSSITXSADEPLOY-3479

.replace("\t", "\\t");
}

public static String sanitize(Object value) {
@stiv03 stiv03 changed the title Sanitize tainted values in log statements (CWE-117) Add LogSanitizer for tainted values in log statements Jun 29, 2026
@stiv03 stiv03 marked this pull request as draft June 29, 2026 06:32
@stiv03 stiv03 marked this pull request as ready for review June 30, 2026 07:08
@stiv03 stiv03 force-pushed the fix/log-injection-sanitizer branch from efce139 to 266fda6 Compare June 30, 2026 07:11
@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
C Reliability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@theghost5800

Copy link
Copy Markdown
Contributor

Why sanitize is not used for filter classes?

@stiv03

stiv03 commented Jun 30, 2026

Copy link
Copy Markdown
Contributor Author

theghost5800

The filter classes log - request.getRequestURI(), and Tomcat's HTTP parser rejects request lines containing \r, \n or \t with 400 Bad Request before the filter chain runs. So the URI in a filter can never contain those control characters, so they are false positive

@stiv03 stiv03 merged commit d354c8c into master Jun 30, 2026
8 of 9 checks passed
@stiv03 stiv03 deleted the fix/log-injection-sanitizer branch June 30, 2026 11:03
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.

3 participants