socketsecurity 2.2.33__tar.gz → 2.2.35__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 (87) hide show
  1. {socketsecurity-2.2.33 → socketsecurity-2.2.35}/PKG-INFO +9 -2
  2. {socketsecurity-2.2.33 → socketsecurity-2.2.35}/README.md +8 -1
  3. {socketsecurity-2.2.33 → socketsecurity-2.2.35}/pyproject.toml +1 -1
  4. {socketsecurity-2.2.33 → socketsecurity-2.2.35}/socketsecurity/__init__.py +1 -1
  5. {socketsecurity-2.2.33 → socketsecurity-2.2.35}/socketsecurity/core/__init__.py +70 -18
  6. {socketsecurity-2.2.33 → socketsecurity-2.2.35}/socketsecurity/core/tools/reachability.py +5 -0
  7. {socketsecurity-2.2.33 → socketsecurity-2.2.35}/socketsecurity/socketcli.py +2 -1
  8. {socketsecurity-2.2.33 → socketsecurity-2.2.35}/.github/CODEOWNERS +0 -0
  9. {socketsecurity-2.2.33 → socketsecurity-2.2.35}/.github/PULL_REQUEST_TEMPLATE/bug-fix.md +0 -0
  10. {socketsecurity-2.2.33 → socketsecurity-2.2.35}/.github/PULL_REQUEST_TEMPLATE/feature.md +0 -0
  11. {socketsecurity-2.2.33 → socketsecurity-2.2.35}/.github/PULL_REQUEST_TEMPLATE/improvement.md +0 -0
  12. {socketsecurity-2.2.33 → socketsecurity-2.2.35}/.github/PULL_REQUEST_TEMPLATE.md +0 -0
  13. {socketsecurity-2.2.33 → socketsecurity-2.2.35}/.github/workflows/docker-stable.yml +0 -0
  14. {socketsecurity-2.2.33 → socketsecurity-2.2.35}/.github/workflows/pr-preview.yml +0 -0
  15. {socketsecurity-2.2.33 → socketsecurity-2.2.35}/.github/workflows/release.yml +0 -0
  16. {socketsecurity-2.2.33 → socketsecurity-2.2.35}/.github/workflows/version-check.yml +0 -0
  17. {socketsecurity-2.2.33 → socketsecurity-2.2.35}/.gitignore +0 -0
  18. {socketsecurity-2.2.33 → socketsecurity-2.2.35}/.hooks/sync_version.py +0 -0
  19. {socketsecurity-2.2.33 → socketsecurity-2.2.35}/.pre-commit-config.yaml +0 -0
  20. {socketsecurity-2.2.33 → socketsecurity-2.2.35}/.python-version +0 -0
  21. {socketsecurity-2.2.33 → socketsecurity-2.2.35}/Dockerfile +0 -0
  22. {socketsecurity-2.2.33 → socketsecurity-2.2.35}/LICENSE +0 -0
  23. {socketsecurity-2.2.33 → socketsecurity-2.2.35}/Makefile +0 -0
  24. {socketsecurity-2.2.33 → socketsecurity-2.2.35}/docs/README.md +0 -0
  25. {socketsecurity-2.2.33 → socketsecurity-2.2.35}/pytest.ini +0 -0
  26. {socketsecurity-2.2.33 → socketsecurity-2.2.35}/scripts/build_container.sh +0 -0
  27. {socketsecurity-2.2.33 → socketsecurity-2.2.35}/scripts/build_container_flexible.sh +0 -0
  28. {socketsecurity-2.2.33 → socketsecurity-2.2.35}/scripts/deploy-test-docker.sh +0 -0
  29. {socketsecurity-2.2.33 → socketsecurity-2.2.35}/scripts/deploy-test-pypi.sh +0 -0
  30. {socketsecurity-2.2.33 → socketsecurity-2.2.35}/scripts/docker-entrypoint.sh +0 -0
  31. {socketsecurity-2.2.33 → socketsecurity-2.2.35}/scripts/run.sh +0 -0
  32. {socketsecurity-2.2.33 → socketsecurity-2.2.35}/socketsecurity/config.py +0 -0
  33. {socketsecurity-2.2.33 → socketsecurity-2.2.35}/socketsecurity/core/classes.py +0 -0
  34. {socketsecurity-2.2.33 → socketsecurity-2.2.35}/socketsecurity/core/cli_client.py +0 -0
  35. {socketsecurity-2.2.33 → socketsecurity-2.2.35}/socketsecurity/core/exceptions.py +0 -0
  36. {socketsecurity-2.2.33 → socketsecurity-2.2.35}/socketsecurity/core/git_interface.py +0 -0
  37. {socketsecurity-2.2.33 → socketsecurity-2.2.35}/socketsecurity/core/helper/__init__.py +0 -0
  38. {socketsecurity-2.2.33 → socketsecurity-2.2.35}/socketsecurity/core/lazy_file_loader.py +0 -0
  39. {socketsecurity-2.2.33 → socketsecurity-2.2.35}/socketsecurity/core/logging.py +0 -0
  40. {socketsecurity-2.2.33 → socketsecurity-2.2.35}/socketsecurity/core/messages.py +0 -0
  41. {socketsecurity-2.2.33 → socketsecurity-2.2.35}/socketsecurity/core/resource_utils.py +0 -0
  42. {socketsecurity-2.2.33 → socketsecurity-2.2.35}/socketsecurity/core/scm/__init__.py +0 -0
  43. {socketsecurity-2.2.33 → socketsecurity-2.2.35}/socketsecurity/core/scm/base.py +0 -0
  44. {socketsecurity-2.2.33 → socketsecurity-2.2.35}/socketsecurity/core/scm/client.py +0 -0
  45. {socketsecurity-2.2.33 → socketsecurity-2.2.35}/socketsecurity/core/scm/github.py +0 -0
  46. {socketsecurity-2.2.33 → socketsecurity-2.2.35}/socketsecurity/core/scm/gitlab.py +0 -0
  47. {socketsecurity-2.2.33 → socketsecurity-2.2.35}/socketsecurity/core/scm_comments.py +0 -0
  48. {socketsecurity-2.2.33 → socketsecurity-2.2.35}/socketsecurity/core/socket_config.py +0 -0
  49. {socketsecurity-2.2.33 → socketsecurity-2.2.35}/socketsecurity/core/utils.py +0 -0
  50. {socketsecurity-2.2.33 → socketsecurity-2.2.35}/socketsecurity/output.py +0 -0
  51. {socketsecurity-2.2.33 → socketsecurity-2.2.35}/socketsecurity/plugins/__init__.py +0 -0
  52. {socketsecurity-2.2.33 → socketsecurity-2.2.35}/socketsecurity/plugins/base.py +0 -0
  53. {socketsecurity-2.2.33 → socketsecurity-2.2.35}/socketsecurity/plugins/jira.py +0 -0
  54. {socketsecurity-2.2.33 → socketsecurity-2.2.35}/socketsecurity/plugins/manager.py +0 -0
  55. {socketsecurity-2.2.33 → socketsecurity-2.2.35}/socketsecurity/plugins/slack.py +0 -0
  56. {socketsecurity-2.2.33 → socketsecurity-2.2.35}/socketsecurity/plugins/teams.py +0 -0
  57. {socketsecurity-2.2.33 → socketsecurity-2.2.35}/socketsecurity/plugins/webhook.py +0 -0
  58. {socketsecurity-2.2.33 → socketsecurity-2.2.35}/tests/__init__.py +0 -0
  59. {socketsecurity-2.2.33 → socketsecurity-2.2.35}/tests/core/conftest.py +0 -0
  60. {socketsecurity-2.2.33 → socketsecurity-2.2.35}/tests/core/create_diff_input.json +0 -0
  61. {socketsecurity-2.2.33 → socketsecurity-2.2.35}/tests/core/test_diff_generation.py +0 -0
  62. {socketsecurity-2.2.33 → socketsecurity-2.2.35}/tests/core/test_package_and_alerts.py +0 -0
  63. {socketsecurity-2.2.33 → socketsecurity-2.2.35}/tests/core/test_sdk_methods.py +0 -0
  64. {socketsecurity-2.2.33 → socketsecurity-2.2.35}/tests/core/test_supporting_methods.py +0 -0
  65. {socketsecurity-2.2.33 → socketsecurity-2.2.35}/tests/data/fullscans/create_response.json +0 -0
  66. {socketsecurity-2.2.33 → socketsecurity-2.2.35}/tests/data/fullscans/diff/stream_diff.json +0 -0
  67. {socketsecurity-2.2.33 → socketsecurity-2.2.35}/tests/data/fullscans/diff/stream_diff_full.json +0 -0
  68. {socketsecurity-2.2.33 → socketsecurity-2.2.35}/tests/data/fullscans/head_scan/metadata.json +0 -0
  69. {socketsecurity-2.2.33 → socketsecurity-2.2.35}/tests/data/fullscans/head_scan/stream_scan.json +0 -0
  70. {socketsecurity-2.2.33 → socketsecurity-2.2.35}/tests/data/fullscans/head_scan/stream_scan_full.json +0 -0
  71. {socketsecurity-2.2.33 → socketsecurity-2.2.35}/tests/data/fullscans/new_scan/metadata.json +0 -0
  72. {socketsecurity-2.2.33 → socketsecurity-2.2.35}/tests/data/fullscans/new_scan/stream_scan.json +0 -0
  73. {socketsecurity-2.2.33 → socketsecurity-2.2.35}/tests/data/repos/repo_info_error.json +0 -0
  74. {socketsecurity-2.2.33 → socketsecurity-2.2.35}/tests/data/repos/repo_info_no_head.json +0 -0
  75. {socketsecurity-2.2.33 → socketsecurity-2.2.35}/tests/data/repos/repo_info_success.json +0 -0
  76. {socketsecurity-2.2.33 → socketsecurity-2.2.35}/tests/data/settings/security-policy.json +0 -0
  77. {socketsecurity-2.2.33 → socketsecurity-2.2.35}/tests/unit/__init__.py +0 -0
  78. {socketsecurity-2.2.33 → socketsecurity-2.2.35}/tests/unit/test_cli_config.py +0 -0
  79. {socketsecurity-2.2.33 → socketsecurity-2.2.35}/tests/unit/test_client.py +0 -0
  80. {socketsecurity-2.2.33 → socketsecurity-2.2.35}/tests/unit/test_config.py +0 -0
  81. {socketsecurity-2.2.33 → socketsecurity-2.2.35}/tests/unit/test_gitlab_auth.py +0 -0
  82. {socketsecurity-2.2.33 → socketsecurity-2.2.35}/tests/unit/test_gitlab_auth_fallback.py +0 -0
  83. {socketsecurity-2.2.33 → socketsecurity-2.2.35}/tests/unit/test_output.py +0 -0
  84. {socketsecurity-2.2.33 → socketsecurity-2.2.35}/uv.lock +0 -0
  85. {socketsecurity-2.2.33 → socketsecurity-2.2.35}/workflows/bitbucket-pipelines.yml +0 -0
  86. {socketsecurity-2.2.33 → socketsecurity-2.2.35}/workflows/github-actions.yml +0 -0
  87. {socketsecurity-2.2.33 → socketsecurity-2.2.35}/workflows/gitlab-ci.yml +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: socketsecurity
3
- Version: 2.2.33
3
+ Version: 2.2.35
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>
@@ -300,7 +300,9 @@ The CLI now automatically detects repository information from your git environme
300
300
  - **Committer information**: Git commit author details
301
301
  - **Default branch status**: Determined from git repository and CI environment
302
302
  - **Changed files**: Files modified in the current commit (for differential scanning)
303
-
303
+ > **Note on merge commits**:
304
+ > Standard merges (two parents) are supported.
305
+ > For *octopus merges* (three or more parents), Git only reports changes relative to the first parent. This can lead to incomplete or empty file lists if changes only exist relative to other parents. In these cases, differential scanning may be skipped. To ensure coverage, use `--ignore-commit-files` to force a full scan or specify files explicitly with `--files`.
304
306
  ### Default Branch Detection
305
307
 
306
308
  The CLI uses intelligent default branch detection with the following priority:
@@ -485,6 +487,11 @@ The manifest archive feature is useful for:
485
487
 
486
488
  > **Note**: The tar.gz archive preserves the original directory structure, making it easy to extract and examine the files in their proper context.
487
489
 
490
+ ### Differential scan skipped on octopus merge
491
+
492
+ When your repo uses an **octopus merge** (3+ parents), the CLI may not detect all changed files.
493
+ This is expected Git behavior: the default diff only compares the merge result to the first parent.
494
+
488
495
  ## Development
489
496
 
490
497
  This project uses `pyproject.toml` as the primary dependency specification.
@@ -243,7 +243,9 @@ The CLI now automatically detects repository information from your git environme
243
243
  - **Committer information**: Git commit author details
244
244
  - **Default branch status**: Determined from git repository and CI environment
245
245
  - **Changed files**: Files modified in the current commit (for differential scanning)
246
-
246
+ > **Note on merge commits**:
247
+ > Standard merges (two parents) are supported.
248
+ > For *octopus merges* (three or more parents), Git only reports changes relative to the first parent. This can lead to incomplete or empty file lists if changes only exist relative to other parents. In these cases, differential scanning may be skipped. To ensure coverage, use `--ignore-commit-files` to force a full scan or specify files explicitly with `--files`.
247
249
  ### Default Branch Detection
248
250
 
249
251
  The CLI uses intelligent default branch detection with the following priority:
@@ -428,6 +430,11 @@ The manifest archive feature is useful for:
428
430
 
429
431
  > **Note**: The tar.gz archive preserves the original directory structure, making it easy to extract and examine the files in their proper context.
430
432
 
433
+ ### Differential scan skipped on octopus merge
434
+
435
+ When your repo uses an **octopus merge** (3+ parents), the CLI may not detect all changed files.
436
+ This is expected Git behavior: the default diff only compares the merge result to the first parent.
437
+
431
438
  ## Development
432
439
 
433
440
  This project uses `pyproject.toml` as the primary dependency specification.
@@ -6,7 +6,7 @@ build-backend = "hatchling.build"
6
6
 
7
7
  [project]
8
8
  name = "socketsecurity"
9
- version = "2.2.33"
9
+ version = "2.2.35"
10
10
  requires-python = ">= 3.10"
11
11
  license = {"file" = "LICENSE"}
12
12
  dependencies = [
@@ -1,3 +1,3 @@
1
1
  __author__ = 'socket.dev'
2
- __version__ = '2.2.33'
2
+ __version__ = '2.2.35'
3
3
  USER_AGENT = f'SocketPythonCLI/{__version__}'
@@ -442,12 +442,13 @@ class Core:
442
442
  Returns:
443
443
  List containing path to a temporary empty file
444
444
  """
445
- # Create a temporary empty file
446
- temp_fd, temp_path = tempfile.mkstemp(suffix='.empty', prefix='socket_baseline_')
445
+ # Create a temporary directory and then create our specific filename
446
+ temp_dir = tempfile.gettempdir()
447
+ temp_path = os.path.join(temp_dir, '.socket.facts.json')
447
448
 
448
- # Close the file descriptor since we just need the path
449
- # The file is already created and empty
450
- os.close(temp_fd)
449
+ # Create the empty file
450
+ with open(temp_path, 'w') as f:
451
+ pass # Creates an empty file
451
452
 
452
453
  log.debug(f"Created temporary empty file for baseline scan: {temp_path}")
453
454
  return [temp_path]
@@ -524,18 +525,42 @@ class Core:
524
525
  if save_manifest_tar_path and all_files and paths:
525
526
  self.save_manifest_tar(all_files, save_manifest_tar_path, paths[0])
526
527
 
528
+ # If no supported files found, create empty scan
527
529
  if not all_files:
528
- return diff
529
-
530
- try:
531
- # Create new scan
532
- new_scan_start = time.time()
533
- new_full_scan = self.create_full_scan(all_files, params, base_paths=base_paths)
534
- new_scan_end = time.time()
535
- log.info(f"Total time to create new full scan: {new_scan_end - new_scan_start:.2f}")
536
- except APIFailure as e:
537
- log.error(f"Failed to create full scan: {e}")
538
- raise
530
+ log.info("No supported manifest files found - creating empty scan")
531
+ empty_files = Core.empty_head_scan_file()
532
+ try:
533
+ # Create new scan
534
+ new_scan_start = time.time()
535
+ new_full_scan = self.create_full_scan(empty_files, params, base_paths=base_paths)
536
+ new_scan_end = time.time()
537
+ log.info(f"Total time to create empty full scan: {new_scan_end - new_scan_start:.2f}")
538
+
539
+ # Clean up the temporary empty file
540
+ for temp_file in empty_files:
541
+ try:
542
+ os.unlink(temp_file)
543
+ log.debug(f"Cleaned up temporary file: {temp_file}")
544
+ except OSError as e:
545
+ log.warning(f"Failed to clean up temporary file {temp_file}: {e}")
546
+ except Exception as e:
547
+ # Clean up temp files even if scan creation fails
548
+ for temp_file in empty_files:
549
+ try:
550
+ os.unlink(temp_file)
551
+ except OSError:
552
+ pass
553
+ raise e
554
+ else:
555
+ try:
556
+ # Create new scan
557
+ new_scan_start = time.time()
558
+ new_full_scan = self.create_full_scan(all_files, params, base_paths=base_paths)
559
+ new_scan_end = time.time()
560
+ log.info(f"Total time to create new full scan: {new_scan_end - new_scan_start:.2f}")
561
+ except APIFailure as e:
562
+ log.error(f"Failed to create full scan: {e}")
563
+ raise
539
564
 
540
565
  # Construct report URL
541
566
  base_socket = "https://socket.dev/dashboard/org"
@@ -888,8 +913,11 @@ class Core:
888
913
  if save_manifest_tar_path and all_files and paths:
889
914
  self.save_manifest_tar(all_files, save_manifest_tar_path, paths[0])
890
915
 
916
+ # If no supported files found, create empty scan for comparison
917
+ scan_files = all_files
891
918
  if not all_files:
892
- return Diff(id="NO_DIFF_RAN", diff_url="", report_url="")
919
+ log.info("No supported manifest files found - creating empty scan for diff comparison")
920
+ scan_files = Core.empty_head_scan_file()
893
921
 
894
922
  try:
895
923
  # Get head scan ID
@@ -932,19 +960,43 @@ class Core:
932
960
  raise e
933
961
 
934
962
  # Create new scan
963
+ temp_files_to_cleanup = []
964
+ if not all_files: # We're using empty scan files
965
+ temp_files_to_cleanup = scan_files
966
+
935
967
  try:
936
968
  new_scan_start = time.time()
937
- new_full_scan = self.create_full_scan(all_files, params, base_paths=base_paths)
969
+ new_full_scan = self.create_full_scan(scan_files, params, base_paths=base_paths)
938
970
  new_scan_end = time.time()
939
971
  log.info(f"Total time to create new full scan: {new_scan_end - new_scan_start:.2f}")
940
972
  except APIFailure as e:
941
973
  log.error(f"API Error: {e}")
974
+ # Clean up temp files if any
975
+ for temp_file in temp_files_to_cleanup:
976
+ try:
977
+ os.unlink(temp_file)
978
+ except OSError:
979
+ pass
942
980
  sys.exit(1)
943
981
  except Exception as e:
944
982
  import traceback
945
983
  log.error(f"Error creating new full scan: {str(e)}")
946
984
  log.error(f"Stack trace:\n{traceback.format_exc()}")
985
+ # Clean up temp files if any
986
+ for temp_file in temp_files_to_cleanup:
987
+ try:
988
+ os.unlink(temp_file)
989
+ except OSError:
990
+ pass
947
991
  raise
992
+ finally:
993
+ # Clean up temporary empty files if they were created
994
+ for temp_file in temp_files_to_cleanup:
995
+ try:
996
+ os.unlink(temp_file)
997
+ log.debug(f"Cleaned up temporary file: {temp_file}")
998
+ except OSError as e:
999
+ log.warning(f"Failed to clean up temporary file {temp_file}: {e}")
948
1000
 
949
1001
  # Handle diff generation - now we always have both scans
950
1002
  scans_ready = self.check_full_scans_status(head_full_scan_id, new_full_scan.id)
@@ -100,6 +100,7 @@ class ReachabilityAnalyzer:
100
100
  concurrency: Optional[int] = None,
101
101
  additional_params: Optional[List[str]] = None,
102
102
  allow_unverified: bool = False,
103
+ enable_debug: bool = False,
103
104
  ) -> Dict[str, Any]:
104
105
  """
105
106
  Run reachability analysis.
@@ -123,6 +124,7 @@ class ReachabilityAnalyzer:
123
124
  concurrency: Concurrency level for analysis (must be >= 1)
124
125
  additional_params: Additional parameters to pass to coana CLI
125
126
  allow_unverified: Disable SSL certificate verification (sets NODE_TLS_REJECT_UNAUTHORIZED=0)
127
+ enable_debug: Enable debug mode (passes -d flag to coana CLI)
126
128
 
127
129
  Returns:
128
130
  Dict containing scan_id and report_path
@@ -173,6 +175,9 @@ class ReachabilityAnalyzer:
173
175
  if concurrency:
174
176
  cmd.extend(["--concurrency", str(concurrency)])
175
177
 
178
+ if enable_debug:
179
+ cmd.append("-d")
180
+
176
181
  # Add any additional parameters provided by the user
177
182
  if additional_params:
178
183
  cmd.extend(additional_params)
@@ -288,7 +288,8 @@ def main_code():
288
288
  version=config.reach_version,
289
289
  concurrency=config.reach_concurrency,
290
290
  additional_params=config.reach_additional_params,
291
- allow_unverified=config.allow_unverified
291
+ allow_unverified=config.allow_unverified,
292
+ enable_debug=config.enable_debug
292
293
  )
293
294
 
294
295
  log.info(f"Reachability analysis completed successfully")
File without changes
File without changes