@@ -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 "
@@ -148,6 +166,9 @@ def create_parser():
148
166
help = "Add the Apache Tomcat's JAR files to the classpath of the security-scanner." )
149
167
parser .add_argument ("--use-spring-framework" , action = "store_true" ,
150
168
help = "Add the Spring Framework's JAR files to the classpath of the security-scanner." )
169
+ parser .add_argument ("--use-xxe-models-library" , action = "store_true" ,
170
+ help = "Add the Diffblue XXE Models Library's JAR file to the classpath of the security-scanner. "
171
+ "It will be put in front of the JARs of the analysed web application." )
151
172
parser .add_argument ("--data-flow-insensitive-instrumentation" , action = "store_true" ,
152
173
help = "If specified, then the tool 'security-analyser' will use the data-flow insensitive "
153
174
"instrumentation of the checked properties into the output GOTO programs. In that case"
@@ -402,7 +423,7 @@ def __main():
402
423
print ("ERROR: " + common_libraries ["diffblue_models_library" ]["error" ])
403
424
return
404
425
else :
405
- cmdline .libraries += common_libraries ["diffblue_models_library" ]["paths" ]
426
+ cmdline .modelled_libraries += common_libraries ["diffblue_models_library" ]["paths" ]
406
427
407
428
if cmdline .use_java_runtime_library :
408
429
if common_libraries ["java_runtime_library" ]["error" ] is not None :
@@ -425,6 +446,13 @@ def __main():
425
446
else :
426
447
cmdline .libraries += common_libraries ["spring_framework" ]["paths" ]
427
448
449
+ if cmdline .use_xxe_models_library :
450
+ if common_libraries ["javax_xxe_library" ]["error" ] is not None :
451
+ print ("ERROR: " + common_libraries ["javax_xxe_library" ]["error" ])
452
+ return
453
+ else :
454
+ cmdline .modelled_libraries += common_libraries ["javax_xxe_library" ]["paths" ]
455
+
428
456
cmdline .config = os .path .abspath (cmdline .config )
429
457
cmdline .input_path = os .path .abspath (cmdline .input_path )
430
458
cmdline .results_dir = os .path .abspath (cmdline .results_dir )
0 commit comments