3

I'm new to using the Checkmarx tool and just checking for security flaws in code in general. I have a method which is supposed to read from an input stream. The method works, however I am getting XXE and SSRF errors.

 public static String getStringFromInputStream(InputStream is) {
    BufferedReader br = null;
    StringBuilder sb = new StringBuilder();
    String line;
    try {
        br = new BufferedReader(new InputStreamReader(is));
        while ((line = br.readLine()) != null) {
            sb.append(Normalizer.normalize(line, Normalizer.Form.NFD));
        }

    } catch (IOException e) {
        LOG.error(
                "********************",
                e);
    } finally {
        if (br != null) {
            try {
                br.close();
            } catch (IOException e) {
                LOG.error(
                        ******************,
                        e);
            }
        }
    }
    return sb.toString();
}
yaloner
  • 715
  • 2
  • 6
  • 19
Tuss
  • 57
  • 1
  • 9

0 Answers0