socketsecurity 2.2.43__tar.gz → 2.2.51__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. {socketsecurity-2.2.43 → socketsecurity-2.2.51}/PKG-INFO +2 -2
  2. {socketsecurity-2.2.43 → socketsecurity-2.2.51}/pyproject.toml +3 -2
  3. {socketsecurity-2.2.43 → socketsecurity-2.2.51}/socketsecurity/__init__.py +1 -1
  4. {socketsecurity-2.2.43 → socketsecurity-2.2.51}/socketsecurity/config.py +13 -0
  5. {socketsecurity-2.2.43 → socketsecurity-2.2.51}/socketsecurity/core/__init__.py +46 -13
  6. {socketsecurity-2.2.43 → socketsecurity-2.2.51}/socketsecurity/core/tools/reachability.py +8 -3
  7. {socketsecurity-2.2.43 → socketsecurity-2.2.51}/socketsecurity/socketcli.py +36 -11
  8. socketsecurity-2.2.51/uv.lock +1541 -0
  9. socketsecurity-2.2.43/uv.lock +0 -1432
  10. {socketsecurity-2.2.43 → socketsecurity-2.2.51}/.github/CODEOWNERS +0 -0
  11. {socketsecurity-2.2.43 → socketsecurity-2.2.51}/.github/PULL_REQUEST_TEMPLATE/bug-fix.md +0 -0
  12. {socketsecurity-2.2.43 → socketsecurity-2.2.51}/.github/PULL_REQUEST_TEMPLATE/feature.md +0 -0
  13. {socketsecurity-2.2.43 → socketsecurity-2.2.51}/.github/PULL_REQUEST_TEMPLATE/improvement.md +0 -0
  14. {socketsecurity-2.2.43 → socketsecurity-2.2.51}/.github/PULL_REQUEST_TEMPLATE.md +0 -0
  15. {socketsecurity-2.2.43 → socketsecurity-2.2.51}/.github/workflows/docker-stable.yml +0 -0
  16. {socketsecurity-2.2.43 → socketsecurity-2.2.51}/.github/workflows/pr-preview.yml +0 -0
  17. {socketsecurity-2.2.43 → socketsecurity-2.2.51}/.github/workflows/release.yml +0 -0
  18. {socketsecurity-2.2.43 → socketsecurity-2.2.51}/.github/workflows/version-check.yml +0 -0
  19. {socketsecurity-2.2.43 → socketsecurity-2.2.51}/.gitignore +0 -0
  20. {socketsecurity-2.2.43 → socketsecurity-2.2.51}/.hooks/sync_version.py +0 -0
  21. {socketsecurity-2.2.43 → socketsecurity-2.2.51}/.pre-commit-config.yaml +0 -0
  22. {socketsecurity-2.2.43 → socketsecurity-2.2.51}/.python-version +0 -0
  23. {socketsecurity-2.2.43 → socketsecurity-2.2.51}/Dockerfile +0 -0
  24. {socketsecurity-2.2.43 → socketsecurity-2.2.51}/LICENSE +0 -0
  25. {socketsecurity-2.2.43 → socketsecurity-2.2.51}/Makefile +0 -0
  26. {socketsecurity-2.2.43 → socketsecurity-2.2.51}/README.md +0 -0
  27. {socketsecurity-2.2.43 → socketsecurity-2.2.51}/docs/README.md +0 -0
  28. {socketsecurity-2.2.43 → socketsecurity-2.2.51}/pytest.ini +0 -0
  29. {socketsecurity-2.2.43 → socketsecurity-2.2.51}/scripts/build_container.sh +0 -0
  30. {socketsecurity-2.2.43 → socketsecurity-2.2.51}/scripts/build_container_flexible.sh +0 -0
  31. {socketsecurity-2.2.43 → socketsecurity-2.2.51}/scripts/deploy-test-docker.sh +0 -0
  32. {socketsecurity-2.2.43 → socketsecurity-2.2.51}/scripts/deploy-test-pypi.sh +0 -0
  33. {socketsecurity-2.2.43 → socketsecurity-2.2.51}/scripts/docker-entrypoint.sh +0 -0
  34. {socketsecurity-2.2.43 → socketsecurity-2.2.51}/scripts/run.sh +0 -0
  35. {socketsecurity-2.2.43 → socketsecurity-2.2.51}/socketsecurity/core/classes.py +0 -0
  36. {socketsecurity-2.2.43 → socketsecurity-2.2.51}/socketsecurity/core/cli_client.py +0 -0
  37. {socketsecurity-2.2.43 → socketsecurity-2.2.51}/socketsecurity/core/exceptions.py +0 -0
  38. {socketsecurity-2.2.43 → socketsecurity-2.2.51}/socketsecurity/core/git_interface.py +0 -0
  39. {socketsecurity-2.2.43 → socketsecurity-2.2.51}/socketsecurity/core/helper/__init__.py +0 -0
  40. {socketsecurity-2.2.43 → socketsecurity-2.2.51}/socketsecurity/core/lazy_file_loader.py +0 -0
  41. {socketsecurity-2.2.43 → socketsecurity-2.2.51}/socketsecurity/core/logging.py +0 -0
  42. {socketsecurity-2.2.43 → socketsecurity-2.2.51}/socketsecurity/core/messages.py +0 -0
  43. {socketsecurity-2.2.43 → socketsecurity-2.2.51}/socketsecurity/core/resource_utils.py +0 -0
  44. {socketsecurity-2.2.43 → socketsecurity-2.2.51}/socketsecurity/core/scm/__init__.py +0 -0
  45. {socketsecurity-2.2.43 → socketsecurity-2.2.51}/socketsecurity/core/scm/base.py +0 -0
  46. {socketsecurity-2.2.43 → socketsecurity-2.2.51}/socketsecurity/core/scm/client.py +0 -0
  47. {socketsecurity-2.2.43 → socketsecurity-2.2.51}/socketsecurity/core/scm/github.py +0 -0
  48. {socketsecurity-2.2.43 → socketsecurity-2.2.51}/socketsecurity/core/scm/gitlab.py +0 -0
  49. {socketsecurity-2.2.43 → socketsecurity-2.2.51}/socketsecurity/core/scm_comments.py +0 -0
  50. {socketsecurity-2.2.43 → socketsecurity-2.2.51}/socketsecurity/core/socket_config.py +0 -0
  51. {socketsecurity-2.2.43 → socketsecurity-2.2.51}/socketsecurity/core/utils.py +0 -0
  52. {socketsecurity-2.2.43 → socketsecurity-2.2.51}/socketsecurity/output.py +0 -0
  53. {socketsecurity-2.2.43 → socketsecurity-2.2.51}/socketsecurity/plugins/__init__.py +0 -0
  54. {socketsecurity-2.2.43 → socketsecurity-2.2.51}/socketsecurity/plugins/base.py +0 -0
  55. {socketsecurity-2.2.43 → socketsecurity-2.2.51}/socketsecurity/plugins/jira.py +0 -0
  56. {socketsecurity-2.2.43 → socketsecurity-2.2.51}/socketsecurity/plugins/manager.py +0 -0
  57. {socketsecurity-2.2.43 → socketsecurity-2.2.51}/socketsecurity/plugins/slack.py +0 -0
  58. {socketsecurity-2.2.43 → socketsecurity-2.2.51}/socketsecurity/plugins/teams.py +0 -0
  59. {socketsecurity-2.2.43 → socketsecurity-2.2.51}/socketsecurity/plugins/webhook.py +0 -0
  60. {socketsecurity-2.2.43 → socketsecurity-2.2.51}/tests/__init__.py +0 -0
  61. {socketsecurity-2.2.43 → socketsecurity-2.2.51}/tests/core/conftest.py +0 -0
  62. {socketsecurity-2.2.43 → socketsecurity-2.2.51}/tests/core/create_diff_input.json +0 -0
  63. {socketsecurity-2.2.43 → socketsecurity-2.2.51}/tests/core/test_diff_generation.py +0 -0
  64. {socketsecurity-2.2.43 → socketsecurity-2.2.51}/tests/core/test_package_and_alerts.py +0 -0
  65. {socketsecurity-2.2.43 → socketsecurity-2.2.51}/tests/core/test_sdk_methods.py +0 -0
  66. {socketsecurity-2.2.43 → socketsecurity-2.2.51}/tests/core/test_supporting_methods.py +0 -0
  67. {socketsecurity-2.2.43 → socketsecurity-2.2.51}/tests/data/fullscans/create_response.json +0 -0
  68. {socketsecurity-2.2.43 → socketsecurity-2.2.51}/tests/data/fullscans/diff/stream_diff.json +0 -0
  69. {socketsecurity-2.2.43 → socketsecurity-2.2.51}/tests/data/fullscans/diff/stream_diff_full.json +0 -0
  70. {socketsecurity-2.2.43 → socketsecurity-2.2.51}/tests/data/fullscans/head_scan/metadata.json +0 -0
  71. {socketsecurity-2.2.43 → socketsecurity-2.2.51}/tests/data/fullscans/head_scan/stream_scan.json +0 -0
  72. {socketsecurity-2.2.43 → socketsecurity-2.2.51}/tests/data/fullscans/head_scan/stream_scan_full.json +0 -0
  73. {socketsecurity-2.2.43 → socketsecurity-2.2.51}/tests/data/fullscans/new_scan/metadata.json +0 -0
  74. {socketsecurity-2.2.43 → socketsecurity-2.2.51}/tests/data/fullscans/new_scan/stream_scan.json +0 -0
  75. {socketsecurity-2.2.43 → socketsecurity-2.2.51}/tests/data/repos/repo_info_error.json +0 -0
  76. {socketsecurity-2.2.43 → socketsecurity-2.2.51}/tests/data/repos/repo_info_no_head.json +0 -0
  77. {socketsecurity-2.2.43 → socketsecurity-2.2.51}/tests/data/repos/repo_info_success.json +0 -0
  78. {socketsecurity-2.2.43 → socketsecurity-2.2.51}/tests/data/settings/security-policy.json +0 -0
  79. {socketsecurity-2.2.43 → socketsecurity-2.2.51}/tests/unit/__init__.py +0 -0
  80. {socketsecurity-2.2.43 → socketsecurity-2.2.51}/tests/unit/test_cli_config.py +0 -0
  81. {socketsecurity-2.2.43 → socketsecurity-2.2.51}/tests/unit/test_client.py +0 -0
  82. {socketsecurity-2.2.43 → socketsecurity-2.2.51}/tests/unit/test_config.py +0 -0
  83. {socketsecurity-2.2.43 → socketsecurity-2.2.51}/tests/unit/test_gitlab_auth.py +0 -0
  84. {socketsecurity-2.2.43 → socketsecurity-2.2.51}/tests/unit/test_gitlab_auth_fallback.py +0 -0
  85. {socketsecurity-2.2.43 → socketsecurity-2.2.51}/tests/unit/test_output.py +0 -0
  86. {socketsecurity-2.2.43 → socketsecurity-2.2.51}/workflows/bitbucket-pipelines.yml +0 -0
  87. {socketsecurity-2.2.43 → socketsecurity-2.2.51}/workflows/github-actions.yml +0 -0
  88. {socketsecurity-2.2.43 → socketsecurity-2.2.51}/workflows/gitlab-ci.yml +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: socketsecurity
3
- Version: 2.2.43
3
+ Version: 2.2.51
4
4
  Summary: Socket Security CLI for CI/CD
5
5
  Project-URL: Homepage, https://socket.dev
6
6
  Author-email: Douglas Coburn <douglas@socket.dev>
@@ -40,7 +40,7 @@ Requires-Dist: packaging
40
40
  Requires-Dist: prettytable
41
41
  Requires-Dist: python-dotenv
42
42
  Requires-Dist: requests
43
- Requires-Dist: socketdev<4.0.0,>=3.0.21
43
+ Requires-Dist: socketdev<4.0.0,>=3.0.22
44
44
  Provides-Extra: dev
45
45
  Requires-Dist: hatch; extra == 'dev'
46
46
  Requires-Dist: pre-commit; extra == 'dev'
@@ -6,7 +6,7 @@ build-backend = "hatchling.build"
6
6
 
7
7
  [project]
8
8
  name = "socketsecurity"
9
- version = "2.2.43"
9
+ version = "2.2.51"
10
10
  requires-python = ">= 3.10"
11
11
  license = {"file" = "LICENSE"}
12
12
  dependencies = [
@@ -16,7 +16,7 @@ dependencies = [
16
16
  'GitPython',
17
17
  'packaging',
18
18
  'python-dotenv',
19
- 'socketdev>=3.0.21,<4.0.0',
19
+ 'socketdev>=3.0.22,<4.0.0',
20
20
  "bs4>=0.0.2",
21
21
  ]
22
22
  readme = "README.md"
@@ -165,3 +165,4 @@ include = ["socketsecurity", "LICENSE"]
165
165
  dev = [
166
166
  "pre-commit>=4.3.0",
167
167
  ]
168
+
@@ -1,3 +1,3 @@
1
1
  __author__ = 'socket.dev'
2
- __version__ = '2.2.43'
2
+ __version__ = '2.2.51'
3
3
  USER_AGENT = f'SocketPythonCLI/{__version__}'
@@ -77,6 +77,7 @@ class CliConfig:
77
77
  reach_concurrency: Optional[int] = None
78
78
  reach_additional_params: Optional[List[str]] = None
79
79
  only_facts_file: bool = False
80
+ reach_use_only_pregenerated_sboms: bool = False
80
81
 
81
82
  @classmethod
82
83
  def from_args(cls, args_list: Optional[List[str]] = None) -> 'CliConfig':
@@ -139,6 +140,7 @@ class CliConfig:
139
140
  'reach_concurrency': args.reach_concurrency,
140
141
  'reach_additional_params': args.reach_additional_params,
141
142
  'only_facts_file': args.only_facts_file,
143
+ 'reach_use_only_pregenerated_sboms': args.reach_use_only_pregenerated_sboms,
142
144
  'version': __version__
143
145
  }
144
146
  try:
@@ -175,6 +177,11 @@ class CliConfig:
175
177
  logging.error("--only-facts-file requires --reach to be specified")
176
178
  exit(1)
177
179
 
180
+ # Validate that reach_use_only_pregenerated_sboms requires reach
181
+ if args.reach_use_only_pregenerated_sboms and not args.reach:
182
+ logging.error("--reach-use-only-pregenerated-sboms requires --reach to be specified")
183
+ exit(1)
184
+
178
185
  # Validate reach_concurrency is >= 1 if provided
179
186
  if args.reach_concurrency is not None and args.reach_concurrency < 1:
180
187
  logging.error("--reach-concurrency must be >= 1")
@@ -602,6 +609,12 @@ def create_argument_parser() -> argparse.ArgumentParser:
602
609
  action="store_true",
603
610
  help="Submit only the .socket.facts.json file when creating full scan (requires --reach)"
604
611
  )
612
+ reachability_group.add_argument(
613
+ "--reach-use-only-pregenerated-sboms",
614
+ dest="reach_use_only_pregenerated_sboms",
615
+ action="store_true",
616
+ help="When using this option, the scan is created based only on pre-generated CDX and SPDX files in your project. (requires --reach)"
617
+ )
605
618
 
606
619
  parser.add_argument(
607
620
  '--version',
@@ -281,12 +281,13 @@ class Core:
281
281
  except Exception as e:
282
282
  log.error(f"Failed to save manifest tar.gz to {output_path}: {e}")
283
283
 
284
- def find_files(self, path: str) -> List[str]:
284
+ def find_files(self, path: str, ecosystems: Optional[List[str]] = None) -> List[str]:
285
285
  """
286
286
  Finds supported manifest files in the given path.
287
287
 
288
288
  Args:
289
289
  path: Path to search for manifest files.
290
+ ecosystems: Optional list of ecosystems to include. If None, all ecosystems are included.
290
291
 
291
292
  Returns:
292
293
  List of found manifest file paths.
@@ -299,6 +300,9 @@ class Core:
299
300
  patterns = self.get_supported_patterns()
300
301
 
301
302
  for ecosystem in patterns:
303
+ # If ecosystems filter is provided, only include specified ecosystems
304
+ if ecosystems is not None and ecosystem not in ecosystems:
305
+ continue
302
306
  if ecosystem in self.config.excluded_ecosystems:
303
307
  continue
304
308
  log.debug(f'Scanning ecosystem: {ecosystem}')
@@ -343,6 +347,23 @@ class Core:
343
347
 
344
348
  return file_list
345
349
 
350
+ def find_sbom_files(self, path: str) -> List[str]:
351
+ """
352
+ Finds only pre-generated SBOM files (CDX and SPDX) in the given path.
353
+
354
+ This is used with --reach-use-only-pregenerated-sboms to find only
355
+ pre-computed CycloneDX and SPDX manifest files.
356
+
357
+ Args:
358
+ path: Path to search for SBOM files.
359
+
360
+ Returns:
361
+ List of found CDX and SPDX file paths.
362
+ """
363
+ log.debug("Starting Find SBOM Files (CDX and SPDX only)")
364
+ sbom_ecosystems = ['cdx', 'spdx']
365
+ return self.find_files(path, ecosystems=sbom_ecosystems)
366
+
346
367
  def get_supported_patterns(self) -> Dict:
347
368
  """
348
369
  Gets supported file patterns from the Socket API.
@@ -547,7 +568,8 @@ class Core:
547
568
  no_change: bool = False,
548
569
  save_files_list_path: Optional[str] = None,
549
570
  save_manifest_tar_path: Optional[str] = None,
550
- base_paths: Optional[List[str]] = None
571
+ base_paths: Optional[List[str]] = None,
572
+ explicit_files: Optional[List[str]] = None
551
573
  ) -> Diff:
552
574
  """Create a new full scan and return with html_report_url.
553
575
 
@@ -558,6 +580,7 @@ class Core:
558
580
  save_files_list_path: Optional path to save submitted files list for debugging
559
581
  save_manifest_tar_path: Optional path to save manifest files tar.gz archive
560
582
  base_paths: List of base paths for the scan (optional)
583
+ explicit_files: Optional list of explicit files to use instead of discovering files
561
584
 
562
585
  Returns:
563
586
  Dict with full scan data including html_report_url
@@ -571,11 +594,15 @@ class Core:
571
594
  if no_change:
572
595
  return diff
573
596
 
574
- # Find manifest files from all paths
575
- all_files = []
576
- for path in paths:
577
- files = self.find_files(path)
578
- all_files.extend(files)
597
+ # Use explicit files if provided, otherwise find manifest files from all paths
598
+ if explicit_files is not None:
599
+ all_files = explicit_files
600
+ log.debug(f"Using {len(all_files)} explicit files instead of discovering files")
601
+ else:
602
+ all_files = []
603
+ for path in paths:
604
+ files = self.find_files(path)
605
+ all_files.extend(files)
579
606
 
580
607
  # Save submitted files list if requested
581
608
  if save_files_list_path and all_files:
@@ -943,7 +970,8 @@ class Core:
943
970
  no_change: bool = False,
944
971
  save_files_list_path: Optional[str] = None,
945
972
  save_manifest_tar_path: Optional[str] = None,
946
- base_paths: Optional[List[str]] = None
973
+ base_paths: Optional[List[str]] = None,
974
+ explicit_files: Optional[List[str]] = None
947
975
  ) -> Diff:
948
976
  """Create a new diff using the Socket SDK.
949
977
 
@@ -954,16 +982,21 @@ class Core:
954
982
  save_files_list_path: Optional path to save submitted files list for debugging
955
983
  save_manifest_tar_path: Optional path to save manifest files tar.gz archive
956
984
  base_paths: List of base paths for the scan (optional)
985
+ explicit_files: Optional list of explicit files to use instead of discovering files
957
986
  """
958
987
  log.debug(f"starting create_new_diff with no_change: {no_change}")
959
988
  if no_change:
960
989
  return Diff(id="NO_DIFF_RAN", diff_url="", report_url="")
961
990
 
962
- # Find manifest files from all paths
963
- all_files = []
964
- for path in paths:
965
- files = self.find_files(path)
966
- all_files.extend(files)
991
+ # Use explicit files if provided, otherwise find manifest files from all paths
992
+ if explicit_files is not None:
993
+ all_files = explicit_files
994
+ log.debug(f"Using {len(all_files)} explicit files instead of discovering files")
995
+ else:
996
+ all_files = []
997
+ for path in paths:
998
+ files = self.find_files(path)
999
+ all_files.extend(files)
967
1000
 
968
1001
  # Save submitted files list if requested
969
1002
  if save_files_list_path and all_files:
@@ -101,10 +101,11 @@ class ReachabilityAnalyzer:
101
101
  additional_params: Optional[List[str]] = None,
102
102
  allow_unverified: bool = False,
103
103
  enable_debug: bool = False,
104
+ use_only_pregenerated_sboms: bool = False,
104
105
  ) -> Dict[str, Any]:
105
106
  """
106
107
  Run reachability analysis.
107
-
108
+
108
109
  Args:
109
110
  org_slug: Socket organization slug
110
111
  target_directory: Directory to analyze
@@ -125,7 +126,8 @@ class ReachabilityAnalyzer:
125
126
  additional_params: Additional parameters to pass to coana CLI
126
127
  allow_unverified: Disable SSL certificate verification (sets NODE_TLS_REJECT_UNAUTHORIZED=0)
127
128
  enable_debug: Enable debug mode (passes -d flag to coana CLI)
128
-
129
+ use_only_pregenerated_sboms: Use only pre-generated CDX and SPDX files for the scan
130
+
129
131
  Returns:
130
132
  Dict containing scan_id and report_path
131
133
  """
@@ -179,7 +181,10 @@ class ReachabilityAnalyzer:
179
181
 
180
182
  if enable_debug:
181
183
  cmd.append("-d")
182
-
184
+
185
+ if use_only_pregenerated_sboms:
186
+ cmd.append("--use-only-pregenerated-sboms")
187
+
183
188
  # Add any additional parameters provided by the user
184
189
  if additional_params:
185
190
  cmd.extend(additional_params)
@@ -167,6 +167,8 @@ def main_code():
167
167
 
168
168
  # Variable to track if we need to override files with facts file
169
169
  facts_file_to_submit = None
170
+ # Variable to track SBOM files to submit when using --reach-use-only-pregenerated-sboms
171
+ sbom_files_to_submit = None
170
172
 
171
173
  # Git setup
172
174
  is_repo = False
@@ -230,12 +232,14 @@ def main_code():
230
232
  # Run reachability analysis if enabled
231
233
  if config.reach:
232
234
  from socketsecurity.core.tools.reachability import ReachabilityAnalyzer
233
-
235
+
234
236
  log.info("Starting reachability analysis...")
235
-
237
+
236
238
  # Find manifest files in scan paths (excluding .socket.facts.json to avoid circular dependency)
237
239
  log.info("Finding manifest files for reachability analysis...")
238
240
  manifest_files = []
241
+
242
+ # Always find all manifest files for the tar hash upload
239
243
  for scan_path in scan_paths:
240
244
  scan_manifests = core.find_files(scan_path)
241
245
  # Filter out .socket.facts.json files from manifest upload
@@ -289,7 +293,8 @@ def main_code():
289
293
  concurrency=config.reach_concurrency,
290
294
  additional_params=config.reach_additional_params,
291
295
  allow_unverified=config.allow_unverified,
292
- enable_debug=config.enable_debug
296
+ enable_debug=config.enable_debug,
297
+ use_only_pregenerated_sboms=config.reach_use_only_pregenerated_sboms
293
298
  )
294
299
 
295
300
  log.info(f"Reachability analysis completed successfully")
@@ -301,6 +306,17 @@ def main_code():
301
306
  if config.only_facts_file:
302
307
  facts_file_to_submit = os.path.abspath(output_path)
303
308
  log.info(f"Only-facts-file mode: will submit only {facts_file_to_submit}")
309
+
310
+ # If reach-use-only-pregenerated-sboms mode, submit CDX, SPDX, and facts file
311
+ if config.reach_use_only_pregenerated_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
+ # Use relative path for facts file
317
+ if os.path.exists(output_path):
318
+ sbom_files_to_submit.append(output_path)
319
+ log.info(f"Pre-generated SBOMs mode: will submit {len(sbom_files_to_submit)} files (CDX, SPDX, and facts file)")
304
320
 
305
321
  except Exception as e:
306
322
  log.error(f"Reachability analysis failed: {str(e)}")
@@ -331,6 +347,12 @@ def main_code():
331
347
  files_explicitly_specified = True
332
348
  log.debug(f"Overriding files to only submit facts file: {facts_file_to_submit}")
333
349
 
350
+ # Override files if reach-use-only-pregenerated-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
+
334
356
  # Determine files to check based on the new logic
335
357
  files_to_check = []
336
358
  force_api_mode = False
@@ -452,7 +474,7 @@ def main_code():
452
474
  log.info("Push initiated flow")
453
475
  if scm.check_event_type() == "diff":
454
476
  log.info("Starting comment logic for PR/MR event")
455
- diff = core.create_new_diff(scan_paths, params, no_change=should_skip_scan, save_files_list_path=config.save_submitted_files_list, save_manifest_tar_path=config.save_manifest_tar, base_paths=base_paths)
477
+ diff = core.create_new_diff(scan_paths, params, no_change=should_skip_scan, save_files_list_path=config.save_submitted_files_list, save_manifest_tar_path=config.save_manifest_tar, base_paths=base_paths, explicit_files=sbom_files_to_submit)
456
478
  comments = scm.get_comments_for_pr()
457
479
  log.debug("Removing comment alerts")
458
480
 
@@ -505,14 +527,14 @@ def main_code():
505
527
  )
506
528
  else:
507
529
  log.info("Starting non-PR/MR flow")
508
- diff = core.create_new_diff(scan_paths, params, no_change=should_skip_scan, save_files_list_path=config.save_submitted_files_list, save_manifest_tar_path=config.save_manifest_tar, base_paths=base_paths)
530
+ diff = core.create_new_diff(scan_paths, params, no_change=should_skip_scan, save_files_list_path=config.save_submitted_files_list, save_manifest_tar_path=config.save_manifest_tar, base_paths=base_paths, explicit_files=sbom_files_to_submit)
509
531
 
510
532
  output_handler.handle_output(diff)
511
-
533
+
512
534
  elif config.enable_diff and not force_api_mode:
513
535
  # New logic: --enable-diff forces diff mode even with --integration api (no SCM)
514
536
  log.info("Diff mode enabled without SCM integration")
515
- diff = core.create_new_diff(scan_paths, params, no_change=should_skip_scan, save_files_list_path=config.save_submitted_files_list, save_manifest_tar_path=config.save_manifest_tar, base_paths=base_paths)
537
+ diff = core.create_new_diff(scan_paths, params, no_change=should_skip_scan, save_files_list_path=config.save_submitted_files_list, save_manifest_tar_path=config.save_manifest_tar, base_paths=base_paths, explicit_files=sbom_files_to_submit)
516
538
  output_handler.handle_output(diff)
517
539
 
518
540
  elif config.enable_diff and force_api_mode:
@@ -530,12 +552,13 @@ def main_code():
530
552
  no_change=should_skip_scan,
531
553
  save_files_list_path=config.save_submitted_files_list,
532
554
  save_manifest_tar_path=config.save_manifest_tar,
533
- base_paths=base_paths
555
+ base_paths=base_paths,
556
+ explicit_files=sbom_files_to_submit
534
557
  )
535
558
  log.info(f"Full scan created with ID: {diff.id}")
536
559
  log.info(f"Full scan report URL: {diff.report_url}")
537
560
  output_handler.handle_output(diff)
538
-
561
+
539
562
  else:
540
563
  if force_api_mode:
541
564
  log.info("No Manifest files changed, creating Socket Report")
@@ -550,7 +573,8 @@ def main_code():
550
573
  no_change=should_skip_scan,
551
574
  save_files_list_path=config.save_submitted_files_list,
552
575
  save_manifest_tar_path=config.save_manifest_tar,
553
- base_paths=base_paths
576
+ base_paths=base_paths,
577
+ explicit_files=sbom_files_to_submit
554
578
  )
555
579
  log.info(f"Full scan created with ID: {diff.id}")
556
580
  log.info(f"Full scan report URL: {diff.report_url}")
@@ -561,7 +585,8 @@ def main_code():
561
585
  no_change=should_skip_scan,
562
586
  save_files_list_path=config.save_submitted_files_list,
563
587
  save_manifest_tar_path=config.save_manifest_tar,
564
- base_paths=base_paths
588
+ base_paths=base_paths,
589
+ explicit_files=sbom_files_to_submit
565
590
  )
566
591
  output_handler.handle_output(diff)
567
592