github-advanced-security[bot] commented on code in PR #3:
URL: 
https://github.com/apache/sling-org-apache-sling-commons-crypto/pull/3#discussion_r1796964897


##########
src/main/java/org/apache/sling/commons/crypto/webconsole/internal/EncryptWebConsolePlugin.java:
##########
@@ -98,19 +98,16 @@
             writer.println("<p>No crypto service available</p>");
         }
 
-        final String forwardRequestUri = (String) 
request.getAttribute(RequestDispatcher.FORWARD_REQUEST_URI);
-        if (Objects.nonNull(forwardRequestUri) && 
forwardRequestUri.equals(request.getRequestURI())) {
-            final String ciphertext = (String) 
request.getAttribute(ATTRIBUTE_CIPHERTEXT);
-            if (Objects.nonNull(ciphertext)) {
-                final String html = String.format("<p 
id=\"ciphertext\">Encrypted message: %s</p>", ciphertext);
-                writer.println(html);
-            }
+        final String ciphertext = request.getParameter(PARAMETER_CIPHERTEXT);
+        if (Objects.nonNull(ciphertext)) {
+            final String html = String.format("<p id=\"ciphertext\">Encrypted 
message: %s</p>", ciphertext);
+            writer.println(html);

Review Comment:
   ## Endpoints should not be vulnerable to reflected cross-site scripting 
(XSS) attacks
   
   <!--SONAR_ISSUE_KEY:AZJ7x2KNK_WRkc9E9YvU-->Change this code to not reflect 
user-controlled data. <p>See more on <a 
href="https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-commons-crypto&issues=AZJ7x2KNK_WRkc9E9YvU&open=AZJ7x2KNK_WRkc9E9YvU&pullRequest=3";>SonarCloud</a></p>
   
   [Show more 
details](https://github.com/apache/sling-org-apache-sling-commons-crypto/security/code-scanning/1)



-- 
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]

Reply via email to