【发布时间】:2019-05-19 23:08:38
【问题描述】:
在测试期间,我遇到了这个问题。我已经发布了一个带有控制器类和模型输入的 rest API。 在调用 API 时,使用了数组 [{"a":1,"b":2}] 而不是单个字符串。这触发了以下错误:
{
"timestamp": "2018-12-19T12:33:36.729+0000",
"status": 400,
"error": "Bad Request",
"message": "JSON parse error: Cannot deserialize instance of `java.lang.String` out of START_ARRAY token; nested exception is com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize instance of `java.lang.String` out of START_ARRAY token\n at [Source: (PushbackInputStream); line: 3, column: 14] (through reference chain: com.xy.df.model.inputReq[\"req\"])",
"path": "x/y/z"
}
我们没有在应用程序中导入 JACKSON 依赖项,在 POM 中显式导入。我注意到在使用的父 pom jackson 版本是:2.9.5
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.9.5</version>
</dependency>
1. RCE 是否容易受到攻击?如何在 Spring-boot 中解决这个问题? 2. 如何抑制/覆盖异常消息,使客户端永远不知道下面使用了哪些库?
【问题讨论】:
-
看看@controlleradvice
标签: spring-boot jackson jackson-databind