File tree 3 files changed +58
-0
lines changed
smithy-protocol-test-traits/src
main/java/software/amazon/smithy/protocoltests/traits
test/resources/software/amazon/smithy/protocoltests/traits/errorfiles
3 files changed +58
-0
lines changed Original file line number Diff line number Diff line change @@ -66,6 +66,17 @@ abstract class ProtocolTestCaseValidator<T extends Trait> extends AbstractValida
66
66
this .traitClass = traitClass ;
67
67
this .descriptor = descriptor ;
68
68
documentBuilderFactory = DocumentBuilderFactory .newInstance ();
69
+
70
+ // Disallow loading DTDs and more for protocol test contents.
71
+ try {
72
+ documentBuilderFactory .setFeature ("http://apache.org/xml/features/disallow-doctype-decl" , true );
73
+ documentBuilderFactory .setXIncludeAware (false );
74
+ documentBuilderFactory .setExpandEntityReferences (false );
75
+ documentBuilderFactory .setFeature ("http://xml.org/sax/features/external-parameter-entities" , false );
76
+ documentBuilderFactory .setFeature ("http://xml.org/sax/features/external-general-entities" , false );
77
+ } catch (ParserConfigurationException e ) {
78
+ throw new RuntimeException (e );
79
+ }
69
80
}
70
81
71
82
@ Override
Original file line number Diff line number Diff line change
1
+ [DANGER] smithy.example#SayHello: Invalid application/xml content in `smithy.test#httpRequestTests` protocol test case `foo1` | HttpRequestTestsInput
Original file line number Diff line number Diff line change
1
+ namespace smithy.example
2
+
3
+ use smithy.test#httpRequestTests
4
+
5
+ @trait
6
+ @protocolDefinition
7
+ structure testProtocol {}
8
+
9
+ @http (method : " POST" , uri : " /" )
10
+ @httpRequestTests ([
11
+ {
12
+ id : " foo1" ,
13
+ protocol : testProtocol ,
14
+ method : " POST" ,
15
+ uri : " /" ,
16
+ params : {
17
+ type : true
18
+ },
19
+ bodyMediaType : " application/xml" ,
20
+ body : """
21
+ <!DOCTYPE root [
22
+ <!ENTITY hifi "hifi">
23
+ <!ENTITY hifi1 "&hifi;&hifi;&hifi;">
24
+ <!ENTITY hifi2 "&hifi1;&hifi1;&hifi1;">
25
+ <!ENTITY hifi3 "&hifi2;&hifi2;&hifi2;">
26
+ ]>
27
+ <XmlNamespacesResponse xmlns="https://example.com/">
28
+ <nested>
29
+ <foo xmlns:baz="http://baz.com">Foo</foo>
30
+ <values xmlns="http://qux.com">
31
+ <member xmlns="http://bux.com">Bar</member>
32
+ <member xmlns="http://bux.com">Baz</member>
33
+ </values>
34
+ </nested>
35
+ <RequestId>requestid</RequestId>
36
+ </XmlNamespacesResponse>
37
+ """
38
+ }
39
+ ])
40
+ operation SayHello {
41
+ input : SayHelloInput
42
+ }
43
+
44
+ structure SayHelloInput {
45
+ type : Boolean
46
+ }
You can’t perform that action at this time.
0 commit comments