Skip to content

Commit 31003ad

Browse files
authored
Doug/fix skip logic (#95)
* Add guardrail in case manifest file does not exist * Fixed if logic for generate license
1 parent 3095944 commit 31003ad

File tree

7 files changed

+153
-8
lines changed

7 files changed

+153
-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.1.14"
9+
version = "2.1.16"
1010
requires-python = ">= 3.10"
1111
license = {"file" = "LICENSE"}
1212
dependencies = [

requirements-dev.txt

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# generated by rye
2+
# use `rye lock` or `rye sync` to update this lockfile
3+
#
4+
# last locked with the following flags:
5+
# pre: false
6+
# features: ["test"]
7+
# all-features: false
8+
# with-sources: false
9+
# generate-hashes: false
10+
# universal: false
11+
12+
hatchling==1.27.0
13+
hatch==1.14.0
14+
argparse==1.4.0
15+
# via socketsecurity
16+
certifi==2024.12.14
17+
# via requests
18+
charset-normalizer==3.4.1
19+
# via requests
20+
colorama==0.4.6
21+
# via pytest-watch
22+
coverage==7.6.10
23+
# via pytest-cov
24+
docopt==0.6.2
25+
# via pytest-watch
26+
gitdb==4.0.12
27+
# via gitpython
28+
gitpython==3.1.44
29+
# via socketsecurity
30+
idna==3.10
31+
# via requests
32+
iniconfig==2.0.0
33+
# via pytest
34+
mdutils==1.6.0
35+
# via socketsecurity
36+
packaging==24.2
37+
# via pytest
38+
# via socketsecurity
39+
pluggy==1.5.0
40+
# via pytest
41+
prettytable==3.12.0
42+
# via socketsecurity
43+
pytest==8.3.4
44+
# via pytest-asyncio
45+
# via pytest-cov
46+
# via pytest-mock
47+
# via pytest-watch
48+
# via socketsecurity
49+
pytest-asyncio==0.25.1
50+
# via socketsecurity
51+
pytest-cov==6.0.0
52+
# via socketsecurity
53+
pytest-mock==3.14.0
54+
# via socketsecurity
55+
pytest-watch==4.2.0
56+
# via socketsecurity
57+
python-dotenv==1.0.1
58+
# via socketsecurity
59+
requests==2.32.3
60+
# via socket-sdk-python
61+
# via socketsecurity
62+
smmap==5.0.2
63+
# via gitdb
64+
socket-sdk-python==2.0.15
65+
# via socketsecurity
66+
typing-extensions==4.12.2
67+
# via socket-sdk-python
68+
urllib3==2.3.0
69+
# via requests
70+
watchdog==6.0.0
71+
# via pytest-watch
72+
wcwidth==0.2.13
73+
# via prettytable

requirements.txt

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# generated by rye
2+
# use `rye lock` or `rye sync` to update this lockfile
3+
#
4+
# last locked with the following flags:
5+
# pre: false
6+
# features: ["test"]
7+
# all-features: false
8+
# with-sources: false
9+
# generate-hashes: false
10+
# universal: false
11+
12+
argparse==1.4.0
13+
# via socketsecurity
14+
certifi==2024.12.14
15+
# via requests
16+
charset-normalizer==3.4.1
17+
# via requests
18+
colorama==0.4.6
19+
# via pytest-watch
20+
coverage==7.6.10
21+
# via pytest-cov
22+
docopt==0.6.2
23+
# via pytest-watch
24+
gitdb==4.0.12
25+
# via gitpython
26+
gitpython==3.1.44
27+
# via socketsecurity
28+
idna==3.10
29+
# via requests
30+
iniconfig==2.0.0
31+
# via pytest
32+
mdutils==1.6.0
33+
# via socketsecurity
34+
packaging==24.2
35+
# via pytest
36+
# via socketsecurity
37+
pluggy==1.5.0
38+
# via pytest
39+
prettytable==3.12.0
40+
# via socketsecurity
41+
pytest==8.3.4
42+
# via pytest-asyncio
43+
# via pytest-cov
44+
# via pytest-mock
45+
# via pytest-watch
46+
# via socketsecurity
47+
pytest-asyncio==0.25.1
48+
# via socketsecurity
49+
pytest-cov==6.0.0
50+
# via socketsecurity
51+
pytest-mock==3.14.0
52+
# via socketsecurity
53+
pytest-watch==4.2.0
54+
# via socketsecurity
55+
python-dotenv==1.0.1
56+
# via socketsecurity
57+
requests==2.32.3
58+
# via socket-sdk-python
59+
# via socketsecurity
60+
smmap==5.0.2
61+
# via gitdb
62+
socket-sdk-python==2.0.15
63+
# via socketsecurity
64+
typing-extensions==4.12.2
65+
# via socket-sdk-python
66+
urllib3==2.3.0
67+
# via requests
68+
watchdog==6.0.0
69+
# via pytest-watch
70+
wcwidth==0.2.13
71+
# via prettytable

socketsecurity/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
__author__ = 'socket.dev'
2-
__version__ = '2.1.14'
2+
__version__ = '2.1.16'

socketsecurity/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class CliConfig:
4242
enable_sarif: bool = False
4343
disable_overview: bool = False
4444
disable_security_issue: bool = False
45-
files: str = "[]"
45+
files: str = None
4646
ignore_commit_files: bool = False
4747
disable_blocking: bool = False
4848
integration_type: IntegrationType = "api"

socketsecurity/core/__init__.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -860,9 +860,10 @@ def get_source_data(package: Package, packages: dict) -> list:
860860
manifests = ""
861861
if not hasattr(package, "manifestFiles"):
862862
return introduced_by
863-
for manifest_data in package.manifestFiles:
864-
manifest_file = manifest_data.get("file")
865-
manifests += f"{manifest_file};"
863+
if hasattr(package, "manifestFiles"):
864+
for manifest_data in package.manifestFiles:
865+
manifest_file = manifest_data.get("file")
866+
manifests += f"{manifest_file};"
866867
manifests = manifests.rstrip(";")
867868
source = ("direct", manifests)
868869
introduced_by.append(source)

socketsecurity/socketcli.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ def main_code():
130130
files_to_check = set(json.loads(config.files)) # Start with manually specified files
131131

132132
# Add git changes if this is a repo and we're not ignoring commit files
133-
if is_repo and not config.ignore_commit_files:
133+
if is_repo and not config.ignore_commit_files and not files_to_check:
134134
files_to_check.update(git_repo.changed_files)
135135

136136
# Determine if we need to scan based on manifest files
@@ -260,7 +260,7 @@ def main_code():
260260
output_handler.handle_output(diff)
261261

262262
# Handle license generation
263-
if diff is not None and diff.id != "no_diff_id" and config.generate_license:
263+
if not should_skip_scan and diff.id != "no_diff_id" and config.generate_license:
264264
all_packages = {}
265265
for purl in diff.packages:
266266
package = diff.packages[purl]

0 commit comments

Comments
 (0)