You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The potential problem here is the command parameter, which can cause XSS attacks if this parameter contains malicious JavaScript code and the API's response content is rendered directly in the HTML page without proper escaping or filtering. For example, if the value of the command parameter is “<script>alert(‘XSS’)</script>” and the returned Unknown command: <script>alert('XSS')</script> is inserted directly into the HTML, the browser will execute this script.
Fix
To ensure the security of your code, you can escape user input before returning it. Here is an example of escaping using the Apache Commons Text library:
This approach escapes special characters in user input as HTML entities, preventing the execution of malicious scripts on HTML pages.
Additionally, it is highly recommended to take precautions on both the front-end and back-end, including:
Validating and cleaning input on the back-end.
Encoding output on the front-end.
Use security policies such as CSP.
Expected vs Actual Behaviour
Logs
The text was updated successfully, but these errors were encountered:
Description
Registry Version: latest
Persistence type:
Environment
Steps to Reproduce
The potential problem here is the
command
parameter, which can cause XSS attacks if this parameter contains malicious JavaScript code and the API's response content is rendered directly in the HTML page without proper escaping or filtering. For example, if the value of the command parameter is“<script>alert(‘XSS’)</script>”
and the returnedUnknown command: <script>alert('XSS')</script>
is inserted directly into the HTML, the browser will execute this script.Fix
To ensure the security of your code, you can escape user input before returning it. Here is an example of escaping using the Apache Commons Text library:
This approach escapes special characters in user input as HTML entities, preventing the execution of malicious scripts on HTML pages.
Additionally, it is highly recommended to take precautions on both the front-end and back-end, including:
Expected vs Actual Behaviour
Logs
The text was updated successfully, but these errors were encountered: