Skip to content

Commit 8d90da3

Browse files
committed
Cross-site scripting resolved
1 parent b6bc381 commit 8d90da3

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

publish-service/src/main/java/com/ericsson/eiffel/remrem/publish/controller/ProducerController.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,13 @@ public ResponseEntity generateAndPublish(@ApiParam(value = "message protocol", r
287287
return createResponseEntity(HttpStatus.BAD_REQUEST, JSON_FATAL_STATUS, "hohoho");
288288

289289
JsonElement bodyJson = JsonParser.parseString(body);
290+
if (!bodyJson.isJsonObject()) {
291+
return createResponseEntity(HttpStatus.BAD_REQUEST, JSON_FATAL_STATUS, "hohoho");
292+
}
293+
294+
if (!bodyJson.getAsJsonObject().has("hohoho")) {
295+
return createResponseEntity(HttpStatus.BAD_REQUEST, JSON_FATAL_STATUS, "hohoho");
296+
}
290297
// return generateAndPublish(msgProtocol, msgType, userDomain, tag, routingKey, parseData, failIfMultipleFound,
291298
// failIfNoneFound, lookupInExternalERs, lookupLimit, okToLeaveOutInvalidOptionalFields, bodyJson);
292299
String mp = "aaa";
@@ -302,7 +309,7 @@ public ResponseEntity generateAndPublish(@ApiParam(value = "message protocol", r
302309
boolean iof = true;
303310
String jb = "json";
304311
return generateAndPublish(mp, mt, ud, t, rk, pd, fmf,
305-
fnf, lee, ll, iof, jb);
312+
fnf, lee, ll, iof, bodyJson);
306313
} catch (JsonSyntaxException e) {
307314
String exceptionMessage = e.getMessage();
308315
log.error("Unexpected exception caught due to parsed json data", exceptionMessage);

0 commit comments

Comments
 (0)