Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 2 additions & 0 deletions src/skillspector/nodes/analyzers/mcp_least_privilege.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,8 @@ def emit(self, finding: Finding) -> None:
},
path=finding.file,
)
finding.pattern = finding.pattern or finding.message
Comment thread
rng1995 marked this conversation as resolved.
Resolved
finding.finding = finding.finding or finding.matched_text or finding.message
self.findings.append(finding)
self.artifact_findings[finding.file] = artifact_observed

Expand Down
2 changes: 2 additions & 0 deletions src/skillspector/nodes/analyzers/mcp_rug_pull.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ def emit(self, finding: Finding) -> None:
"limit_findings": MAX_FINDINGS_PER_ANALYZER,
},
)
finding.pattern = finding.pattern or finding.message
Comment thread
rng1995 marked this conversation as resolved.
Resolved
finding.finding = finding.finding or finding.matched_text or finding.message
Comment thread
rng1995 marked this conversation as resolved.
Resolved
self.findings.append(finding)
self.artifact_findings[finding.file] = artifact_observed

Expand Down
7 changes: 7 additions & 0 deletions tests/test_mcp_least_privilege.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,14 @@

from __future__ import annotations

import json
import re
from pathlib import Path

import yaml

from skillspector.nodes.analyzers import mcp_least_privilege
from skillspector.nodes.report import report

# ---------------------------------------------------------------------------
# Fixture directory path
Expand Down Expand Up @@ -259,6 +261,11 @@ def test_no_permissions_field(self):
assert lp3.severity == "MEDIUM"
assert lp3.confidence >= 0.70
assert lp3.file == "SKILL.md"
issue = json.loads(
report({"filtered_findings": [lp3], "output_format": "json"})["report_body"]
)["issues"][0]
assert issue["pattern"] == lp3.message
assert issue["finding"] == lp3.message


class TestLP3AllowedTools:
Expand Down
6 changes: 6 additions & 0 deletions tests/test_mcp_rug_pull.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
from skillspector.nodes.analyzers.mcp_rug_pull import node
from skillspector.nodes.build_context import build_context
from skillspector.nodes.deduplicate import deduplicate
from skillspector.nodes.report import report
from skillspector.state import SkillspectorState


Expand All @@ -47,6 +48,11 @@ def test_rp1_npx_unpinned():
rp1 = [f for f in result["findings"] if f.rule_id == "RP1"]
assert len(rp1) == 1
assert "npx @scope/mcp-server" in rp1[0].matched_text
issue = json.loads(report({"filtered_findings": rp1, "output_format": "json"})["report_body"])[
"issues"
][0]
assert issue["pattern"] == rp1[0].message
assert issue["finding"] == "npx @scope/mcp-server"


def test_rp1_scans_cached_files_without_a_manifest():
Expand Down
Loading