@@ -167,6 +167,8 @@ def main_code():
167167
168168 # Variable to track if we need to override files with facts file
169169 facts_file_to_submit = None
170+ # Variable to track SBOM files to submit when using --reach-only-use-pre-generated-sboms
171+ sbom_files_to_submit = None
170172
171173 # Git setup
172174 is_repo = False
@@ -230,12 +232,14 @@ def main_code():
230232 # Run reachability analysis if enabled
231233 if config .reach :
232234 from socketsecurity .core .tools .reachability import ReachabilityAnalyzer
233-
235+
234236 log .info ("Starting reachability analysis..." )
235-
237+
236238 # Find manifest files in scan paths (excluding .socket.facts.json to avoid circular dependency)
237239 log .info ("Finding manifest files for reachability analysis..." )
238240 manifest_files = []
241+
242+ # Always find all manifest files for the tar hash upload
239243 for scan_path in scan_paths :
240244 scan_manifests = core .find_files (scan_path )
241245 # Filter out .socket.facts.json files from manifest upload
@@ -289,7 +293,8 @@ def main_code():
289293 concurrency = config .reach_concurrency ,
290294 additional_params = config .reach_additional_params ,
291295 allow_unverified = config .allow_unverified ,
292- enable_debug = config .enable_debug
296+ enable_debug = config .enable_debug ,
297+ use_only_pregenerated_sboms = config .reach_only_use_pre_generated_sboms
293298 )
294299
295300 log .info (f"Reachability analysis completed successfully" )
@@ -301,6 +306,17 @@ def main_code():
301306 if config .only_facts_file :
302307 facts_file_to_submit = os .path .abspath (output_path )
303308 log .info (f"Only-facts-file mode: will submit only { facts_file_to_submit } " )
309+
310+ # If reach-only-use-pre-generated-sboms mode, submit CDX, SPDX, and facts file
311+ if config .reach_only_use_pre_generated_sboms :
312+ # Find only CDX and SPDX files for the final scan submission
313+ sbom_files_to_submit = []
314+ for scan_path in scan_paths :
315+ sbom_files_to_submit .extend (core .find_sbom_files (scan_path ))
316+ facts_path = os .path .abspath (output_path )
317+ if os .path .exists (facts_path ):
318+ sbom_files_to_submit .append (facts_path )
319+ log .info (f"Pre-generated SBOMs mode: will submit { len (sbom_files_to_submit )} files (CDX, SPDX, and facts file)" )
304320
305321 except Exception as e :
306322 log .error (f"Reachability analysis failed: { str (e )} " )
@@ -331,6 +347,12 @@ def main_code():
331347 files_explicitly_specified = True
332348 log .debug (f"Overriding files to only submit facts file: { facts_file_to_submit } " )
333349
350+ # Override files if reach-only-use-pre-generated-sboms mode is active
351+ if sbom_files_to_submit :
352+ specified_files = sbom_files_to_submit
353+ files_explicitly_specified = True
354+ log .debug (f"Overriding files to submit only SBOM files (CDX, SPDX, and facts): { sbom_files_to_submit } " )
355+
334356 # Determine files to check based on the new logic
335357 files_to_check = []
336358 force_api_mode = False
0 commit comments