Add section on RFD + whitelist yml/properties/csv

Issue: SPR-13643
This commit is contained in:
Rossen Stoyanchev
2015-11-05 16:39:03 -05:00
parent b46a301e8a
commit f0464e8176
4 changed files with 98 additions and 43 deletions

View File

@@ -109,9 +109,13 @@ public class ContentNegotiationConfigurer {
/**
* Add a mapping from a key, extracted from a path extension or a query
* parameter, to a MediaType. This is required in order for the parameter
* strategy to work. The path extension strategy will also try
* {@link ServletContext#getMimeType} and JAF if it is present and is not
* suppressed via {@link #useJaf}.
* strategy to work. Any extensions explicitly registered here are also
* whitelisted for the purpose of Reflected File Download attack detection
* (see Spring Framework reference documentation for more details on RFD
* attack protection).
* <p>The path extension strategy will also try to use
* {@link ServletContext#getMimeType} and JAF (if present) to resolve path
* extensions. To change this behavior see the {@link #useJaf} property.
* @param extension the key to look up
* @param mediaType the media type
* @see #mediaTypes(Map)

View File

@@ -73,7 +73,9 @@ public abstract class AbstractMessageConverterMethodProcessor extends AbstractMe
/* Extensions associated with the built-in message converters */
private static final Set<String> WHITELISTED_EXTENSIONS = new HashSet<String>(Arrays.asList(
"txt", "text", "json", "xml", "atom", "rss", "png", "jpe", "jpeg", "jpg", "gif", "wbmp", "bmp"));
"txt", "text", "yml", "properties", "csv",
"json", "xml", "atom", "rss",
"png", "jpe", "jpeg", "jpg", "gif", "wbmp", "bmp"));
private final ContentNegotiationManager contentNegotiationManager;