Open
Conversation
|
|
||
| protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { | ||
| // ruleid: crlf-injection-logs-deepsemgrep-sanitizer | ||
| log.info("foo"+request.getParameter("param")); |
There was a problem hiding this comment.
When data from an untrusted source is put into a logger and not neutralized correctly, an attacker could forge log entries or include malicious content. Please use Jsoup.clean() to sanitize logger data.
View Dataflow Graph
flowchart LR
classDef invis fill:white, stroke: none
classDef default fill:#e7f5ff, color:#1c7fd6, stroke: none
subgraph File0["<b>r2c-david.java</b>"]
direction LR
%% Source
subgraph Source
direction LR
v0("<b>[Line: 7]</b> request.getParameter(#quot;param#quot;)")
end
%% Intermediate
%% Sink
subgraph Sink
direction LR
v1("<b>[Line: 7]</b> log.info(#quot;foo#quot;+request.getParameter(#quot;param#quot;));")
end
end
%% Class Assignment
Source:::invis
Sink:::invis
File0:::invis
%% Connections
Source --> Sink
%% Clickable
click v0 href "https://github.com/Semgrep-NA-Workshop/JavaSpringVulny-app/blob/de5c809ae7f572507cacd9f4831419c3f1f3e940/r2c-david.java#L7" "View in source" _blank
click v1 href "https://github.com/Semgrep-NA-Workshop/JavaSpringVulny-app/blob/de5c809ae7f572507cacd9f4831419c3f1f3e940/r2c-david.java#L7" "View in source" _blank
There was a problem hiding this comment.
Semgrep Assistant thinks you might be able to fix the finding like this:
Suggested change
| log.info("foo"+request.getParameter("param")); | |
| log.info("foo" + Jsoup.clean(request.getParameter("param"), Whitelist.none())); |
AI-generated comment. Please review the code carefully.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.