Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
### 2.12.0 (Unreleased)
### Features/Bug Fixes
* fix(sc1): stop reporting the requirement ranges recorded inside `package-lock.json` and `npm-shrinkwrap.json` as unpinned dependencies; the lockfile pins every install, and `package.json` ranges are still reported (#1104)
* fix(deps): bump the locked `pyasn1` from 0.6.4 to 0.6.5 (CVE-2026-119194, CVE-2026-119195, CVE-2026-119196, CVE-2026-119197), `cryptography` from 49.0.0 to 50.0.2 (CVE-2026-69247) and the `[mcp]` extra's `pyjwt` from 2.13.0 to 2.15.1 (CVE-2026-102268 and related advisories) (#1146)
* fix(deps): bump the locked `langgraph` from 1.2.6 to 1.2.20 (and `langgraph-checkpoint` 4.1.1 to 4.3.1, which it requires) past GHSA-3fx2-cqw9-xr3c; the locked `langgraph-sdk` 0.4.10 was already patched (#1078)
* fix(pi): accept scans from symlinked workspace roots while preserving the CLI's checks on symlinks below the workspace. Custom YARA rules loaded with `--yara-rules-dir` cannot use `include`; place each rule directly in the selected directory.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2639,7 +2639,10 @@ def line_number(start: int) -> int:
tag = [PatternCategory.SUPPLY_CHAIN.value]

is_dep_file = _is_dependency_manifest(file_path)
if is_dep_file:
# An npm lockfile pins every install to an exact version. The ranges it also
# records are the installed packages' own declared requirements, so they are
# not unpinned dependencies of the skill.
if is_dep_file and not _is_npm_lockfile(file_path):
for pattern, confidence in SC1_PATTERNS:
matches = (
static_runner.iter_paragraph_matches
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,53 @@ def test_toml_lock_parser_returns_empty_for_malformed_toml():
assert supply_chain._extract_packages_from_toml_lock(content) == []


_NPM_LOCK_WITH_TRANSITIVE_RANGES = """{
"name": "demo",
"version": "1.0.0",
"lockfileVersion": 3,
"packages": {
"": {
"name": "demo",
"version": "1.0.0",
"dependencies": {
"ajv": "8.17.1"
}
},
"node_modules/ajv": {
"version": "8.17.1",
"dependencies": {
"fast-deep-equal": "^3.1.3"
},
"peerDependencies": {
"react": "*"
}
},
"node_modules/fast-deep-equal": {
"version": "3.1.3"
}
}
}
"""


@pytest.mark.parametrize("path", ["package-lock.json", "mcp/npm-shrinkwrap.json"])
def test_npm_lockfile_requirement_ranges_are_not_unpinned_dependencies(path):
findings = supply_chain.analyze(_NPM_LOCK_WITH_TRANSITIVE_RANGES, path, "json")

assert not [finding for finding in findings if finding.rule_id == "SC1"]


def test_package_json_ranges_are_still_unpinned_dependencies():
content = '{"dependencies": {"ajv": "^8.17.1", "react": "*"}}'

findings = supply_chain.analyze(content, "package.json", "json")

assert {finding.matched_text for finding in findings if finding.rule_id == "SC1"} == {
'"ajv": "^8.17.1"',
'"react": "*"',
}


@pytest.mark.parametrize("path", ["package.json", "package-lock.json", "npm-shrinkwrap.json"])
@pytest.mark.parametrize("is_cached", [True, False], ids=["present-empty", "missing"])
def test_node_distinguishes_empty_dependency_file_from_missing_cache_entry(
Expand Down
Loading