Skip to content

Commit bb93697

Browse files
committed
CM-55551 CLI SCA Scan Fails to Detect Indirect Dependencies Due to PNPM Lock File Handling
1 parent 9b17d7c commit bb93697

File tree

2 files changed

+13
-15
lines changed

2 files changed

+13
-15
lines changed

cycode/cli/files_collector/sca/base_restore_dependencies.py

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ def build_dep_tree_path(path: str, generated_file_name: str) -> str:
1414

1515

1616
def execute_commands(
17-
commands: list[list[str]],
18-
timeout: int,
19-
output_file_path: Optional[str] = None,
20-
working_directory: Optional[str] = None,
17+
commands: list[list[str]],
18+
timeout: int,
19+
output_file_path: Optional[str] = None,
20+
working_directory: Optional[str] = None,
2121
) -> Optional[str]:
2222
try:
2323
outputs = []
@@ -40,7 +40,7 @@ def execute_commands(
4040

4141
class BaseRestoreDependencies(ABC):
4242
def __init__(
43-
self, ctx: typer.Context, is_git_diff: bool, command_timeout: int, create_output_file_manually: bool = False
43+
self, ctx: typer.Context, is_git_diff: bool, command_timeout: int, create_output_file_manually: bool = False
4444
) -> None:
4545
self.ctx = ctx
4646
self.is_git_diff = is_git_diff
@@ -57,11 +57,14 @@ def get_manifest_file_path(self, document: Document) -> str:
5757

5858
def try_restore_dependencies(self, document: Document) -> Optional[Document]:
5959
manifest_file_path = self.get_manifest_file_path(document)
60-
restore_file_paths = [build_dep_tree_path(document.absolute_path, restore_file_path_item) for
61-
restore_file_path_item in self.get_lock_file_names()]
60+
restore_file_paths = [
61+
build_dep_tree_path(document.absolute_path, restore_file_path_item)
62+
for restore_file_path_item in self.get_lock_file_names()
63+
]
6264
restore_file_path = self.get_any_restore_file_already_exist(restore_file_paths)
63-
relative_restore_file_path = build_dep_tree_path(document.path,
64-
self.get_restored_lock_file_name(restore_file_path))
65+
relative_restore_file_path = build_dep_tree_path(
66+
document.path, self.get_restored_lock_file_name(restore_file_path)
67+
)
6568

6669
if self.verify_lockfile_missing(restore_file_path):
6770
output = execute_commands(

cycode/cli/files_collector/sca/npm/restore_npm_dependencies.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,7 @@
77

88
NPM_PROJECT_FILE_EXTENSIONS = ['.json']
99
NPM_LOCK_FILE_NAME = 'package-lock.json'
10-
NPM_LOCK_FILE_NAMES = [
11-
NPM_LOCK_FILE_NAME,
12-
'yarn.lock',
13-
'pnpm-lock.yaml',
14-
'deno.lock'
15-
]
10+
NPM_LOCK_FILE_NAMES = [NPM_LOCK_FILE_NAME, 'yarn.lock', 'pnpm-lock.yaml', 'deno.lock']
1611
NPM_MANIFEST_FILE_NAME = 'package.json'
1712

1813

0 commit comments

Comments
 (0)