在记录响应时出现了 REST API 错误。

huangapple 未分类评论47阅读模式
英文:

getting error in rest api while logging the response

问题

以下是您提供的代码部分的翻译:

我有以下的 Java 代码,其中我使用了一个 RestTemplate 来交换一些数据,并从第三方服务获取响应,如下所示:

ResponseEntity<String> response = restTemplate.exchange(restApiUrl,
    HttpMethod.POST, entity, String.class);
LOGGER.info("来自UIDAI的XML响应:" + response.getBody()); //** 错误**//

但在使用 Fortify 进行扫描时,它显示在 Java 类中的 restTemplateCall() 方法将未经验证的用户输入写入日志。攻击者可以利用此行为伪造日志条目或将恶意内容注入日志中。

请指导如何解决这个问题。

英文:

I have the below java code in which i making use of an rest template to exchange some data and getting response from third party service as shown below

 ResponseEntity&lt;String&gt; response = restTemplate.exchange(restApiUrl,
                HttpMethod.POST, entity, String.class);
        LOGGER.info(&quot;XML Response from UIDAI :&quot; + response.getBody()); //** Error**//

but upon scanning with fortify it is showing he method restTemplateCall() in java class writes unvalidated user input to the log . An attacker could take advantage of this behavior to forge log entries or inject malicious content into the log

Please advise how to overcome from this .

huangapple
  • 本文由 发表于 2020年5月4日 12:08:08
  • 转载请务必保留本文链接:https://java.coder-hub.com/61585033.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定