OpenFeign / feign

Feign makes writing java http clients easier
Apache License 2.0
9.51k stars 1.93k forks source link

Fix code scanning alert no. 8: Cross-site scripting #2612

Closed velo closed 1 month ago

velo commented 1 month ago

Fixes https://github.com/OpenFeign/feign/security/code-scanning/8

To fix the cross-site scripting vulnerability, we need to sanitize the user input before including it in the response. The best way to do this is to use a library that provides HTML escaping functionality to ensure that any potentially malicious characters in the filename are properly encoded.

We will:

  1. Import the StringEscapeUtils class from the Apache Commons Text library.
  2. Use the escapeHtml4 method to sanitize the filename before appending it to the response.

Suggested fixes powered by Copilot Autofix. Review carefully before merging.