@@ -69,11 +69,24 @@ def get_spring_framework_props():
69
69
props ["spring_framework" ]["error" ] = "Cannot access Spring Framework's directory " + directory
70
70
return props
71
71
72
+ def get_javax_xxe_library_props ():
73
+ props = {"javax_xxe_library" : {
74
+ "paths" : [
75
+ os .path .join (get_benchmark_library_dir (), "javax_xxe_library" , "target" , "javax_xxe_models.jar" )
76
+ ],
77
+ "error" : None
78
+ }}
79
+ for jar in props ["javax_xxe_library" ]["paths" ]:
80
+ if not os .path .isfile (jar ):
81
+ props ["javax_xxe_library" ]["error" ] = "Cannot find '" + os .path .basename (jar ) + "' in the directory " + os .path .dirname (jar )
82
+ return props
83
+
72
84
result = {}
73
85
result .update (get_diffblue_models_library_props ())
74
86
result .update (get_java_runtime_library ())
75
87
result .update (get_apache_tomcat_props ())
76
88
result .update (get_spring_framework_props ())
89
+ result .update (get_javax_xxe_library_props ())
77
90
return result
78
91
79
92
@@ -92,6 +105,11 @@ def create_parser():
92
105
parser .add_argument ("-L" , "--libraries" , nargs = '+' , default = [],
93
106
help = "A list of disk paths to libraries you want to include into class path. A path "
94
107
"can either be a path-name of a JAR file, or a directory." )
108
+ parser .add_argument ("-M" , "--modelled-libraries" , nargs = '+' , default = [],
109
+ help = "A list of disk paths to models of libraries you want to include into class path. A path "
110
+ "can either be a path-name of a JAR file, or a directory. The paths will be put to the "
111
+ "classpath BEFORE JAR files of the analysed web application and also libraries passed "
112
+ "via the option --libraries." )
95
113
parser .add_argument ("-E" , "--entry-point" , "--entry-points" , nargs = '+' , default = [],
96
114
help = "Allows you to specify a list of Java functions which will be considered by the analyser as an "
97
115
"entry point. Typically, a function of a class implementing javax.servlet.http.HttpServlet "
@@ -139,7 +157,8 @@ def create_parser():
139
157
"option the GOTO binary won't be produced and taint analysis is applied directly to "
140
158
"the loaded Java program (translated to GOTO in the memory)." )
141
159
parser .add_argument ("--use-models-library" , action = "store_true" ,
142
- help = "Add the Diffblue Models Library's JAR file to the classpath of the security-scanner." )
160
+ help = "Add the Diffblue Models Library's JAR file to the classpath of the security-scanner. "
161
+ "It will be put in front of the JARs of the analysed web application." )
143
162
parser .add_argument ("--use-java-runtime-library" , action = "store_true" ,
144
163
help = "Add the Java standard library to the classpath. First, there will be attempt to add "
145
164
"OpenJDK version of the library. If it is not found (e.g. not installed), then the "
@@ -148,6 +167,9 @@ def create_parser():
148
167
help = "Add the Apache Tomcat's JAR files to the classpath of the security-scanner." )
149
168
parser .add_argument ("--use-spring-framework" , action = "store_true" ,
150
169
help = "Add the Spring Framework's JAR files to the classpath of the security-scanner." )
170
+ parser .add_argument ("--use-xxe-models-library" , action = "store_true" ,
171
+ help = "Add the Diffblue XXE Models Library's JAR file to the classpath of the security-scanner. "
172
+ "It will be put in front of the JARs of the analysed web application." )
151
173
parser .add_argument ("--data-flow-insensitive-instrumentation" , action = "store_true" ,
152
174
help = "If specified, then the tool 'security-analyser' will use the data-flow insensitive "
153
175
"instrumentation of the checked properties into the output GOTO programs. In that case"
@@ -402,7 +424,7 @@ def __main():
402
424
print ("ERROR: " + common_libraries ["diffblue_models_library" ]["error" ])
403
425
return
404
426
else :
405
- cmdline .libraries += common_libraries ["diffblue_models_library" ]["paths" ]
427
+ cmdline .modelled_libraries += common_libraries ["diffblue_models_library" ]["paths" ]
406
428
407
429
if cmdline .use_java_runtime_library :
408
430
if common_libraries ["java_runtime_library" ]["error" ] is not None :
@@ -425,6 +447,13 @@ def __main():
425
447
else :
426
448
cmdline .libraries += common_libraries ["spring_framework" ]["paths" ]
427
449
450
+ if cmdline .use_xxe_models_library :
451
+ if common_libraries ["javax_xxe_library" ]["error" ] is not None :
452
+ print ("ERROR: " + common_libraries ["javax_xxe_library" ]["error" ])
453
+ return
454
+ else :
455
+ cmdline .modelled_libraries += common_libraries ["javax_xxe_library" ]["paths" ]
456
+
428
457
cmdline .config = os .path .abspath (cmdline .config )
429
458
cmdline .input_path = os .path .abspath (cmdline .input_path )
430
459
cmdline .results_dir = os .path .abspath (cmdline .results_dir )
0 commit comments