Skip to content

Commit 4db876e

Browse files
committed
Since the API Changes to not accept unsupported files changed the temp scan file to be .socket.facts.json to pass the validator. Also, added the debug flag support to the reachability engine
1 parent ec36f08 commit 4db876e

File tree

5 files changed

+15
-8
lines changed

5 files changed

+15
-8
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ build-backend = "hatchling.build"
66

77
[project]
88
name = "socketsecurity"
9-
version = "2.2.33"
9+
version = "2.2.34"
1010
requires-python = ">= 3.10"
1111
license = {"file" = "LICENSE"}
1212
dependencies = [

socketsecurity/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
__author__ = 'socket.dev'
2-
__version__ = '2.2.33'
2+
__version__ = '2.2.34'
33
USER_AGENT = f'SocketPythonCLI/{__version__}'

socketsecurity/core/__init__.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -442,12 +442,13 @@ def empty_head_scan_file() -> List[str]:
442442
Returns:
443443
List containing path to a temporary empty file
444444
"""
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')
447448

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
451452

452453
log.debug(f"Created temporary empty file for baseline scan: {temp_path}")
453454
return [temp_path]

socketsecurity/core/tools/reachability.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ def run_reachability_analysis(
100100
concurrency: Optional[int] = None,
101101
additional_params: Optional[List[str]] = None,
102102
allow_unverified: bool = False,
103+
enable_debug: bool = False,
103104
) -> Dict[str, Any]:
104105
"""
105106
Run reachability analysis.
@@ -123,6 +124,7 @@ def run_reachability_analysis(
123124
concurrency: Concurrency level for analysis (must be >= 1)
124125
additional_params: Additional parameters to pass to coana CLI
125126
allow_unverified: Disable SSL certificate verification (sets NODE_TLS_REJECT_UNAUTHORIZED=0)
127+
enable_debug: Enable debug mode (passes -d flag to coana CLI)
126128
127129
Returns:
128130
Dict containing scan_id and report_path
@@ -173,6 +175,9 @@ def run_reachability_analysis(
173175
if concurrency:
174176
cmd.extend(["--concurrency", str(concurrency)])
175177

178+
if enable_debug:
179+
cmd.append("-d")
180+
176181
# Add any additional parameters provided by the user
177182
if additional_params:
178183
cmd.extend(additional_params)

socketsecurity/socketcli.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,8 @@ def main_code():
288288
version=config.reach_version,
289289
concurrency=config.reach_concurrency,
290290
additional_params=config.reach_additional_params,
291-
allow_unverified=config.allow_unverified
291+
allow_unverified=config.allow_unverified,
292+
enable_debug=config.enable_debug
292293
)
293294

294295
log.info(f"Reachability analysis completed successfully")

0 commit comments

Comments
 (0)