File tree Expand file tree Collapse file tree 2 files changed +14
-3
lines changed
spring-oxm/src/main/java/org/springframework/oxm/xstream Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Original file line number Diff line number Diff line change 7575/**
7676 * Implementation of the {@code Marshaller} interface for XStream.
7777 *
78- * <p>By default, XStream does not require any further configuration,
79- * though class aliases can be used to have more control over the behavior of XStream.
78+ * <p>By default, XStream does not require any further configuration and can (un)marshal
79+ * any class on the classpath. As such, it is <b>not recommended to use the
80+ * {@code XStreamMarshaller} to unmarshal XML from external sources</b> (i.e. the Web), as
81+ * this can result in <b>security vulnerabilities</b>. If you do use the
82+ * {@code XStreamMarshaller} to unmarshal external XML, set the
83+ * {@link #setConverters(ConverterMatcher[]) converters} and
84+ * {@link #setSupportedClasses(Class[]) supportedClasses} properties or override the
85+ * {@link #customizeXStream(XStream)} method to make sure it only accepts the classes
86+ * you want it to support.
8087 *
8188 * <p>Due to XStream's API, it is required to set the encoding used for writing to OutputStreams.
8289 * It defaults to {@code UTF-8}.
Original file line number Diff line number Diff line change @@ -755,7 +755,11 @@ public class Application {
755755 <para >
756756 By default, XStream allows for arbitrary classes to be unmarshalled, which can result in security
757757 vulnerabilities.
758- As such, it is recommended to set the <property >supportedClasses</property > property on the
758+ As such, it is <emphasis >not recommended to use the <classname >XStreamMarshaller</classname > to
759+ unmarshal XML from external sources</emphasis > (i.e. the Web), as this can result in
760+ <emphasis >security vulnerabilities</emphasis >.
761+ If you do use the <classname >XStreamMarshaller</classname > to unmarshal XML from an external source,
762+ set the <property >supportedClasses</property > property on the
759763 <classname >XStreamMarshaller</classname >, like so:
760764 <programlisting language =" xml" ><![CDATA[ <bean id="xstreamMarshaller" class="org.springframework.oxm.xstream.XStreamMarshaller">
761765 <property name="supportedClasses" value="org.springframework.oxm.xstream.Flight"/>
You can’t perform that action at this time.
0 commit comments