socketsecurity 2.0.13__tar.gz → 2.0.14__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 (32) hide show
  1. {socketsecurity-2.0.13/socketsecurity.egg-info → socketsecurity-2.0.14}/PKG-INFO +1 -1
  2. {socketsecurity-2.0.13 → socketsecurity-2.0.14}/socketsecurity/__init__.py +1 -1
  3. {socketsecurity-2.0.13 → socketsecurity-2.0.14}/socketsecurity/config.py +1 -1
  4. {socketsecurity-2.0.13 → socketsecurity-2.0.14}/socketsecurity/core/__init__.py +50 -27
  5. {socketsecurity-2.0.13 → socketsecurity-2.0.14/socketsecurity.egg-info}/PKG-INFO +1 -1
  6. {socketsecurity-2.0.13 → socketsecurity-2.0.14}/LICENSE +0 -0
  7. {socketsecurity-2.0.13 → socketsecurity-2.0.14}/README.md +0 -0
  8. {socketsecurity-2.0.13 → socketsecurity-2.0.14}/pyproject.toml +0 -0
  9. {socketsecurity-2.0.13 → socketsecurity-2.0.14}/setup.cfg +0 -0
  10. {socketsecurity-2.0.13 → socketsecurity-2.0.14}/socketsecurity/core/classes.py +0 -0
  11. {socketsecurity-2.0.13 → socketsecurity-2.0.14}/socketsecurity/core/cli_client.py +0 -0
  12. {socketsecurity-2.0.13 → socketsecurity-2.0.14}/socketsecurity/core/exceptions.py +0 -0
  13. {socketsecurity-2.0.13 → socketsecurity-2.0.14}/socketsecurity/core/git_interface.py +0 -0
  14. {socketsecurity-2.0.13 → socketsecurity-2.0.14}/socketsecurity/core/issues.py +0 -0
  15. {socketsecurity-2.0.13 → socketsecurity-2.0.14}/socketsecurity/core/licenses.py +0 -0
  16. {socketsecurity-2.0.13 → socketsecurity-2.0.14}/socketsecurity/core/logging.py +0 -0
  17. {socketsecurity-2.0.13 → socketsecurity-2.0.14}/socketsecurity/core/messages.py +0 -0
  18. {socketsecurity-2.0.13 → socketsecurity-2.0.14}/socketsecurity/core/scm/__init__.py +0 -0
  19. {socketsecurity-2.0.13 → socketsecurity-2.0.14}/socketsecurity/core/scm/base.py +0 -0
  20. {socketsecurity-2.0.13 → socketsecurity-2.0.14}/socketsecurity/core/scm/client.py +0 -0
  21. {socketsecurity-2.0.13 → socketsecurity-2.0.14}/socketsecurity/core/scm/github.py +0 -0
  22. {socketsecurity-2.0.13 → socketsecurity-2.0.14}/socketsecurity/core/scm/gitlab.py +0 -0
  23. {socketsecurity-2.0.13 → socketsecurity-2.0.14}/socketsecurity/core/scm_comments.py +0 -0
  24. {socketsecurity-2.0.13 → socketsecurity-2.0.14}/socketsecurity/core/socket_config.py +0 -0
  25. {socketsecurity-2.0.13 → socketsecurity-2.0.14}/socketsecurity/core/utils.py +0 -0
  26. {socketsecurity-2.0.13 → socketsecurity-2.0.14}/socketsecurity/output.py +0 -0
  27. {socketsecurity-2.0.13 → socketsecurity-2.0.14}/socketsecurity/socketcli.py +0 -0
  28. {socketsecurity-2.0.13 → socketsecurity-2.0.14}/socketsecurity.egg-info/SOURCES.txt +0 -0
  29. {socketsecurity-2.0.13 → socketsecurity-2.0.14}/socketsecurity.egg-info/dependency_links.txt +0 -0
  30. {socketsecurity-2.0.13 → socketsecurity-2.0.14}/socketsecurity.egg-info/entry_points.txt +0 -0
  31. {socketsecurity-2.0.13 → socketsecurity-2.0.14}/socketsecurity.egg-info/requires.txt +0 -0
  32. {socketsecurity-2.0.13 → socketsecurity-2.0.14}/socketsecurity.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: socketsecurity
3
- Version: 2.0.13
3
+ Version: 2.0.14
4
4
  Summary: Socket Security CLI for CI/CD
5
5
  Author-email: Douglas Coburn <douglas@socket.dev>
6
6
  Maintainer-email: Douglas Coburn <douglas@socket.dev>
@@ -1,2 +1,2 @@
1
1
  __author__ = 'socket.dev'
2
- __version__ = '2.0.13'
2
+ __version__ = '2.0.14'
@@ -55,7 +55,7 @@ class CliConfig:
55
55
  'pr_number': args.pr_number,
56
56
  'commit_message': commit_message,
57
57
  'default_branch': args.default_branch,
58
- 'target_path': args.target_path,
58
+ 'target_path': os.path.expanduser(args.target_path),
59
59
  'scm': args.scm,
60
60
  'sbom_file': args.sbom_file,
61
61
  'commit_sha': args.commit_sha,
@@ -5,8 +5,8 @@ import time
5
5
  from dataclasses import asdict
6
6
  from glob import glob
7
7
  from pathlib import PurePath
8
- from typing import BinaryIO, Dict, List, Tuple
9
-
8
+ from typing import BinaryIO, Dict, List, Tuple, Set
9
+ import re
10
10
  from socketdev import socketdev
11
11
  from socketdev.exceptions import APIFailure
12
12
  from socketdev.fullscans import FullScanParams, SocketArtifact
@@ -123,19 +123,42 @@ class Core:
123
123
  log.error(result.get("message", "No error message provided"))
124
124
  return {}
125
125
 
126
+ @staticmethod
127
+ def expand_brace_pattern(pattern: str) -> List[str]:
128
+ """
129
+ Expands brace expressions (e.g., {a,b,c}) into separate patterns.
130
+ """
131
+ brace_regex = re.compile(r"\{([^{}]+)\}")
132
+
133
+ # Expand all brace groups
134
+ expanded_patterns = [pattern]
135
+ while any("{" in p for p in expanded_patterns):
136
+ new_patterns = []
137
+ for pat in expanded_patterns:
138
+ match = brace_regex.search(pat)
139
+ if match:
140
+ options = match.group(1).split(",") # Extract values inside {}
141
+ prefix, suffix = pat[:match.start()], pat[match.end():]
142
+ new_patterns.extend([prefix + opt + suffix for opt in options])
143
+ else:
144
+ new_patterns.append(pat)
145
+ expanded_patterns = new_patterns
146
+
147
+ return expanded_patterns
148
+
126
149
  def find_files(self, path: str) -> List[str]:
127
150
  """
128
151
  Finds supported manifest files in the given path.
129
152
 
130
153
  Args:
131
- path: Path to search for manifest files
154
+ path: Path to search for manifest files.
132
155
 
133
156
  Returns:
134
- List of found manifest file paths
157
+ List of found manifest file paths.
135
158
  """
136
159
  log.debug("Starting Find Files")
137
160
  start_time = time.time()
138
- files = set()
161
+ files: Set[str] = set()
139
162
 
140
163
  # Get supported patterns from the API
141
164
  try:
@@ -149,28 +172,28 @@ class Core:
149
172
  for ecosystem in patterns:
150
173
  ecosystem_patterns = patterns[ecosystem]
151
174
  for file_name in ecosystem_patterns:
152
- pattern = Core.to_case_insensitive_regex(ecosystem_patterns[file_name]["pattern"])
153
- file_path = f"{path}/**/{pattern}"
154
- #log.debug(f"Globbing {file_path}")
155
- glob_start = time.time()
156
- glob_files = glob(file_path, recursive=True)
157
- for glob_file in glob_files:
158
- # Only add if it's a file, not a directory
159
- if glob_file not in files and os.path.isfile(glob_file):
160
- files.add(glob_file)
161
- glob_end = time.time()
162
- glob_total_time = glob_end - glob_start
163
- #log.debug(f"Glob for pattern {file_path} took {glob_total_time:.2f} seconds")
164
-
165
- log.debug("Finished Find Files")
166
- end_time = time.time()
167
- total_time = end_time - start_time
168
- files_list = list(files)
169
- if len(files_list) > 5:
170
- log.debug(f"{len(files_list)} Files found ({total_time:.2f}s): {', '.join(files_list[:5])}, ...")
171
- else:
172
- log.debug(f"{len(files_list)} Files found ({total_time:.2f}s): {', '.join(files_list)}")
173
- return list(files)
175
+ original_pattern = ecosystem_patterns[file_name]["pattern"]
176
+
177
+ # Expand brace patterns
178
+ expanded_patterns = Core.expand_brace_pattern(original_pattern)
179
+
180
+ for pattern in expanded_patterns:
181
+ case_insensitive_pattern = Core.to_case_insensitive_regex(pattern)
182
+ file_path = os.path.join(path, "**", case_insensitive_pattern)
183
+
184
+ log.debug(f"Globbing {file_path}")
185
+ glob_start = time.time()
186
+ glob_files = glob(file_path, recursive=True)
187
+
188
+ for glob_file in glob_files:
189
+ if os.path.isfile(glob_file):
190
+ files.add(glob_file)
191
+
192
+ glob_end = time.time()
193
+ log.debug(f"Globbing took {glob_end - glob_start:.4f} seconds")
194
+
195
+ log.debug(f"Total files found: {len(files)}")
196
+ return sorted(files)
174
197
 
175
198
  def get_supported_patterns(self) -> Dict:
176
199
  """
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: socketsecurity
3
- Version: 2.0.13
3
+ Version: 2.0.14
4
4
  Summary: Socket Security CLI for CI/CD
5
5
  Author-email: Douglas Coburn <douglas@socket.dev>
6
6
  Maintainer-email: Douglas Coburn <douglas@socket.dev>
File without changes