Copilot commented on code in PR #4332:
URL: 
https://github.com/apache/incubator-kie-kogito-runtimes/pull/4332#discussion_r3534563833


##########
drools/kogito-pmml/src/main/java/org/kie/kogito/pmml/AbstractPMMLRestResource.java:
##########
@@ -40,9 +40,10 @@ protected PMML4Result descriptive(Application application, 
String fileName, Stri
     }
 
     public static String getJsonErrorMessage(Exception e) {
+        String rawMessage = e.getMessage() != null ? e.getMessage() : "";
+        String sanitizedMessage = rawMessage.replaceAll("[\r\n]", "_");

Review Comment:
   The current sanitization only targets `\r` and `\n` individually, so 
Windows-style `\r\n` becomes `__` and other Unicode line separators (e.g., 
`\u2028`, `\u2029`) are left untouched. Using Java regex `\\R+` will normalize 
any line-break sequence to a single `_`, improving readability while more 
robustly preventing log forging.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to