Skip to content

Commit 7e1c56a

Browse files
committed
Merge remote-tracking branch 'origin/main' into docs/include-module-folders-behavior
2 parents 06d9a88 + b398288 commit 7e1c56a

6 files changed

Lines changed: 39 additions & 18 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
11
# Changelog
22

3+
## 2.13.2
4+
5+
### Changed
6+
7+
- Manifest file links in PR comments and reports pick the source host only from
8+
`--scm`. The fallback that guessed GitHub, GitLab, or Bitbucket from the Socket
9+
diff URL never produced a link and has been removed.
10+
11+
### Documentation
12+
13+
- `--include-module-folders` help and docs now say what the flag does: every
14+
supported manifest under `node_modules`, `bower_components` or `jspm_packages`,
15+
nested folders included, is added to the scan, and Socket resolves the
16+
dependencies those files declare. It does not list installed packages. The troubleshooting guide covers scanning
17+
packages installed outside the lockfile with a CycloneDX SBOM.
18+
319
## 2.13.1
420

521
### Documentation
@@ -11,11 +27,6 @@
1127
comparisons fall back to a less resilient path with only a warning.
1228
- Documented how the baseline scan for a comparison is chosen.
1329
- Listed all four accepted token environment variables in priority order.
14-
- `--include-module-folders` help and docs now say what the flag does: every
15-
supported manifest under `node_modules`, `bower_components` or `jspm_packages`,
16-
nested folders included, is added to the scan, and Socket resolves the
17-
dependencies those files declare. It does not list installed packages. The troubleshooting guide covers scanning
18-
packages installed outside the lockfile with a CycloneDX SBOM.
1930

2031
### Changed: bump the Socket Python SDK to 3.6.3
2132

‎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.13.1"
9+
version = "2.13.2"
1010
requires-python = ">= 3.11"
1111
license = {"file" = "LICENSE"}
1212
dependencies = [

‎socketsecurity/__init__.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
__author__ = 'socket.dev'
2-
__version__ = '2.13.1'
2+
__version__ = '2.13.2'
33
USER_AGENT_NAME = 'socket-python-cli'
44
USER_AGENT = f'{USER_AGENT_NAME}/{__version__}'

‎socketsecurity/core/messages.py‎

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -78,18 +78,10 @@ def get_manifest_file_url(diff: Diff, manifest_path: str, config=None) -> str:
7878
# Remove leading slashes
7979
clean_path = clean_path.lstrip('/')
8080

81-
# Determine SCM type from config or diff_url
82-
scm_type = "api" # Default to API
81+
# diff.diff_url points at Socket, not the SCM, so only config decides.
82+
scm_type = "api"
8383
if config and hasattr(config, 'scm'):
8484
scm_type = config.scm.lower()
85-
elif hasattr(diff, 'diff_url') and diff.diff_url:
86-
diff_url = diff.diff_url.lower()
87-
if 'github.com' in diff_url or 'github' in diff_url:
88-
scm_type = "github"
89-
elif 'gitlab' in diff_url:
90-
scm_type = "gitlab"
91-
elif 'bitbucket' in diff_url:
92-
scm_type = "bitbucket"
9385

9486
# Generate URL based on SCM type using config information
9587
# NEVER use diff.diff_url for SCM URLs - those are Socket URLs for "View report" links

‎tests/unit/test_messages.py‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,3 +102,21 @@ def test_manifest_link_falls_back_to_the_report_without_a_repository_url():
102102
url = Messages.get_manifest_file_url(diff, "app/package.json", config)
103103

104104
assert url == "https://socket.dev/report/123?tab=files&file=app%2Fpackage.json"
105+
106+
107+
108+
def test_manifest_link_does_not_guess_the_scm_from_the_diff_url():
109+
"""Without an explicit scm, a GitHub-looking diff_url falls back to the report."""
110+
111+
class _NoScmConfig:
112+
branch = "main"
113+
repository_url = "https://github.com/acme/widgets"
114+
115+
diff = Diff(
116+
diff_url="https://github.com/acme/widgets/pull/1",
117+
report_url="https://socket.dev/report/123",
118+
)
119+
120+
url = Messages.get_manifest_file_url(diff, "app/package.json", _NoScmConfig())
121+
122+
assert url == "https://socket.dev/report/123?tab=files&file=app%2Fpackage.json"

‎uv.lock‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)