@@ -66,6 +66,15 @@ def add_arguments(self, parser):
66
66
default = False ,
67
67
help = "Mark findings as verified (default: False)" ,
68
68
)
69
+ parser .add_argument (
70
+ "--tags" ,
71
+ action = "append" ,
72
+ default = [],
73
+ help = (
74
+ "Tag(s) to apply to the imported Test (repeat --tags to add multiple). "
75
+ "Example: --tags perf --tags jfrog"
76
+ ),
77
+ )
69
78
70
79
def get_test_admin (self ):
71
80
return User .objects .get (username = "admin" )
@@ -138,7 +147,7 @@ def deduce_scan_type_from_path(self, scan_file_path):
138
147
raise CommandError (msg )
139
148
140
149
def import_unittest_scan (self , scan_file , product_name , engagement_name , product_type_name ,
141
- minimum_severity , active , verified ):
150
+ minimum_severity , active , verified , tags ):
142
151
"""
143
152
Import a specific unittest scan file.
144
153
@@ -173,13 +182,18 @@ def import_unittest_scan(self, scan_file, product_name, engagement_name, product
173
182
"version" : "1.0.1" ,
174
183
"active" : active ,
175
184
"verified" : verified ,
185
+ "apply_tags_to_findings" : True ,
186
+ "apply_tags_to_endpoints" : True ,
176
187
"auto_create_context" : True ,
177
188
"product_type_name" : product_type_name ,
178
189
"product_name" : product_name ,
179
190
"engagement_name" : engagement_name ,
180
191
"close_old_findings" : False ,
181
192
}
182
193
194
+ if tags :
195
+ payload ["tags" ] = tags
196
+
183
197
result = self .import_scan (payload )
184
198
185
199
logger .info (f"Successfully imported scan. Test ID: { result .get ('test_id' )} " )
@@ -195,6 +209,7 @@ def handle(self, *args, **options):
195
209
minimum_severity = options ["minimum_severity" ]
196
210
active = options ["active" ]
197
211
verified = options ["verified" ]
212
+ tags = options ["tags" ]
198
213
199
214
start_time = time .time ()
200
215
@@ -207,6 +222,7 @@ def handle(self, *args, **options):
207
222
minimum_severity = minimum_severity ,
208
223
active = active ,
209
224
verified = verified ,
225
+ tags = tags ,
210
226
)
211
227
212
228
end_time = time .time ()
0 commit comments