Skip to content

Commit

Permalink
Testing 234
Browse files Browse the repository at this point in the history
  • Loading branch information
kadraman committed Nov 4, 2024
1 parent d4e4f19 commit 934f055
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/main/java/com/microfocus/example/utils/UserUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ public static void registerUser(String firstName, String lastName, String email)
jGenerator.writeRawValue("\"" + (String) person.get("firstName") + "\"");
jGenerator.writeFieldName("lastName");
jGenerator.writeRawValue("\"" + (String) person.get("lastName") + "\"");
jGenerator.writeFieldName("fullName");
jGenerator.writeRawValue("\"" + (String) person.get("firstName") + " " + (String) person.get("lastName") + "\"");
jGenerator.writeFieldName("email");
jGenerator.writeRawValue("\"" + (String) person.get("email") + "\"");
jGenerator.writeFieldName("role");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,15 @@ public ResponseEntity<String> getKeywordsContent(@Param("keywords") String keywo
return ResponseEntity.ok().body(retContent);
}

@GetMapping("/xss-test")
@ResponseBody
public ResponseEntity<String> getSearchResults(@Param("keywords") String keywords) {

String retContent = "Product search using: " + keywords;

return ResponseEntity.ok().body(retContent);

Check warning

Code scanning / Fortify on Demand

Cross-Site Scripting: Reflected Warning

The method getKeywordsContent() in ProductController.java sends unvalidated data to a web browser on line 97, which can result in the browser executing malicious code. More information
}

@GetMapping(value = {"", "/"})
public String index(Model model, @Param("keywords") String keywords, @Param("limit") Integer limit, Principal principal) {
log.debug("Searching for products using keywords: " + ((keywords == null || keywords.isEmpty()) ? "none" : keywords));
Expand Down

0 comments on commit 934f055

Please sign in to comment.