Change default JSON prefix from "{} && " to ")]}', "
Issue: SPR-13078
This commit is contained in:
@@ -99,16 +99,15 @@ public class MappingJackson2JsonView extends AbstractJackson2View {
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates whether the JSON output by this view should be prefixed with <tt>"{} && "</tt>.
|
||||
* Indicates whether the JSON output by this view should be prefixed with <tt>")]}', "</tt>.
|
||||
* Default is {@code false}.
|
||||
* <p>Prefixing the JSON string in this manner is used to help prevent JSON Hijacking.
|
||||
* The prefix renders the string syntactically invalid as a script so that it cannot be hijacked.
|
||||
* This prefix does not affect the evaluation of JSON, but if JSON validation is performed
|
||||
* on the string, the prefix would need to be ignored.
|
||||
* This prefix should be stripped before parsing the string as JSON.
|
||||
* @see #setJsonPrefix
|
||||
*/
|
||||
public void setPrefixJson(boolean prefixJson) {
|
||||
this.jsonPrefix = (prefixJson ? "{} && " : null);
|
||||
this.jsonPrefix = (prefixJson ? ")]}', " : null);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user