Skip to content

Commit a50b9c9

Browse files
authored
Merge pull request #692 from agentsope/fix/673-sc4-evidence-wording
fix(sc4): align report guidance with vulnerability evidence
2 parents 4dcf7f1 + 6e73790 commit a50b9c9

4 files changed

Lines changed: 497 additions & 8 deletions

File tree

‎src/skillspector/nodes/analyzers/pattern_defaults.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ class PatternCategory(StrEnum):
9494
"RA1": "Skill modifies its own code, configuration, or behavior at runtime. Self-modification enables an agent to escalate privileges, disable safety constraints, or install persistent backdoors.",
9595
"RA2": "Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.",
9696
# Supply Chain extensions (B.1.4)
97-
"SC4": "Dependency has known vulnerabilities (CVEs). Using packages with unpatched security flaws exposes the environment to known exploits.",
97+
"SC4": "Dependency vulnerability evidence requires review. This finding does not by itself confirm that the installed release is affected; check the resolved version, advisory applicability, and lookup coverage.",
9898
"SC5": "Dependency appears abandoned or unmaintained. Abandoned packages no longer receive security patches, leaving known and future vulnerabilities unaddressed.",
9999
"SC6": "Package name closely resembles a popular package, suggesting possible typosquatting. Attackers publish malicious packages with similar names to trick developers into installing them.",
100100
"SC7": "Code pulls a container image with signature or registry verification disabled (--disable-content-trust, DOCKER_CONTENT_TRUST=0, --insecure-registry). This accepts tampered or unverified images and is a container supply-chain risk.",
@@ -407,7 +407,7 @@ class PatternCategory(StrEnum):
407407
"RA1": "Prevent the skill from modifying its own code, SKILL.md, or configuration files. Treat skill files as read-only at runtime.",
408408
"RA2": "Remove any persistence mechanisms (cron jobs, startup scripts, state files). Skills should not maintain state across sessions without explicit user consent.",
409409
# Supply Chain extensions (B.1.4)
410-
"SC4": "Update the dependency to a patched version that addresses the known CVE. Check OSV (osv.dev) or NVD for details on the vulnerability.",
410+
"SC4": "Determine the dependency's resolved version and verify the advisory evidence and lookup coverage in OSV (osv.dev) or NVD. If the resolved release is affected, update to a verified fixed release when available, or remove or replace the affected dependency when no fix exists. Retry incomplete lookups before relying on their results.",
411411
"SC5": "Replace the abandoned dependency with an actively maintained alternative. Check the package's repository for last commit date and open issues.",
412412
"SC6": "Verify the package name is correct and not a typosquatting variant. Compare against the official package name on PyPI or npm.",
413413
"SC7": "Keep image signature verification (Docker Content Trust / cosign) and registry TLS enabled. Pull only signed images from trusted registries; never disable content-trust or use insecure registries in skill code.",

‎src/skillspector/nodes/analyzers/static_patterns_supply_chain.py‎

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2498,6 +2498,15 @@ def _sc4_from_osv_detailed(
24982498
f" — {len(vulns)} advisory(ies): {vuln_desc}"
24992499
)
25002500
matched_text = f"{pkg_name}=={pkg_version}"
2501+
explanation = (
2502+
"OSV returned vulnerability advisories matching the dependency's resolved "
2503+
"version. Review the matched advisories to assess their impact."
2504+
)
2505+
remediation = (
2506+
"Review the matched advisories in OSV (osv.dev) for affected and fixed releases. "
2507+
"If a fixed release is available, update to a release that addresses the "
2508+
"matched advisories; otherwise remove or replace the affected dependency."
2509+
)
25012510
else:
25022511
# No resolvable version: OSV was queried by name only, so these advisories are
25032512
# NOT matched against the release that will actually be installed — they are the
@@ -2513,6 +2522,17 @@ def _sc4_from_osv_detailed(
25132522
" whether the installed release is affected"
25142523
)
25152524
matched_text = pkg_name
2525+
explanation = (
2526+
"OSV returned advisories for this package, but its resolved version is "
2527+
"unknown. A package-name lookup does not establish whether the installed "
2528+
"release is affected by those advisories."
2529+
)
2530+
remediation = (
2531+
"Determine the dependency's exact resolved version from the environment or "
2532+
"lockfile and compare it with the advisories in OSV (osv.dev). If it is "
2533+
"affected, use a verified fixed release or remove or replace the dependency "
2534+
"when no fix is available."
2535+
)
25162536
findings.append(
25172537
AnalyzerFinding(
25182538
rule_id="SC4",
@@ -2522,6 +2542,8 @@ def _sc4_from_osv_detailed(
25222542
confidence=confidence,
25232543
tags=tag,
25242544
matched_text=matched_text,
2545+
explanation=explanation,
2546+
remediation=remediation,
25252547
)
25262548
)
25272549
limitations = (
@@ -2553,6 +2575,16 @@ def _sc4_from_fallback(
25532575
confidence=confidence,
25542576
tags=tag,
25552577
matched_text=pkg_name,
2578+
explanation=(
2579+
"The static fallback database identifies this package as vulnerable "
2580+
"or malicious without a version threshold. This evidence does not "
2581+
"identify an available fixed release."
2582+
),
2583+
remediation=(
2584+
"Review the cited advisory and remove or replace the affected "
2585+
"dependency with a maintained alternative. Do not assume a version "
2586+
"upgrade resolves the issue without verifying the advisory."
2587+
),
25562588
)
25572589
)
25582590
elif pkg_version and _version_lt(pkg_version, max_safe):
@@ -2568,6 +2600,16 @@ def _sc4_from_fallback(
25682600
confidence=confidence,
25692601
tags=tag,
25702602
matched_text=f"{pkg_name}=={pkg_version}",
2603+
explanation=(
2604+
"The dependency's resolved version is below the fixed-version "
2605+
"threshold recorded in the static fallback database. Review the "
2606+
"cited advisory to confirm applicability."
2607+
),
2608+
remediation=(
2609+
f"Update the dependency to version {max_safe} or later, as recorded "
2610+
"in the static fallback database, and verify the cited advisory "
2611+
"and compatibility before installing."
2612+
),
25712613
)
25722614
)
25732615
return findings
@@ -2752,6 +2794,18 @@ def retain(extra: list[AnalyzerFinding]) -> None:
27522794
confidence=1.0,
27532795
tags=tag,
27542796
matched_text="SC4 fallback active",
2797+
explanation=(
2798+
"The live vulnerability lookup failed, and the limited static fallback "
2799+
"database found no matching advisory. Vulnerability coverage is "
2800+
"incomplete; this does not establish that the dependencies are "
2801+
"vulnerable or safe."
2802+
),
2803+
remediation=(
2804+
"Retry the scan and verify dependency versions against current "
2805+
"advisories before relying on the incomplete results. If the lookup "
2806+
"timed out or the network was unavailable, check connectivity to "
2807+
"api.osv.dev or adjust SKILLSPECTOR_OSV_TIMEOUT before retrying."
2808+
),
27552809
)
27562810
]
27572811
)

‎src/skillspector/nodes/meta_analyzer.py‎

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -568,12 +568,15 @@ def apply_filter(
568568
if outcome != "confirmed":
569569
result.append(_mark_unconfirmed(f, outcome, assessment))
570570
continue
571-
explanation = (assessment.get("explanation") or "").strip() or get_explanation(
572-
f.rule_id
573-
)
574-
remediation = (assessment.get("remediation") or "").strip() or get_remediation(
575-
f.rule_id
576-
)
571+
explanation = (assessment.get("explanation") or "").strip()
572+
remediation = (assessment.get("remediation") or "").strip()
573+
# Resolve SC4's evidence-specific fallback per matched finding,
574+
# including when one coarse assessment confirms multiple findings.
575+
if f.rule_id == "SC4":
576+
explanation = explanation or (f.explanation or "").strip()
577+
remediation = remediation or (f.remediation or "").strip()
578+
explanation = explanation or get_explanation(f.rule_id)
579+
remediation = remediation or get_remediation(f.rule_id)
577580
confidence = float(assessment.get("confidence", 0.7))
578581
result.append(
579582
replace(

0 commit comments

Comments
 (0)