Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
b71384c
test(analyzer): define shell truthiness core contract
chrisknvidia Sep 17, 2026
9668515
fix(analyzer): detect bound shell truthiness
chrisknvidia Sep 17, 2026
bd09251
fix(analyzer): harden bound shell facts
chrisknvidia Sep 17, 2026
b6a9ad7
Merge remote-tracking branch 'origin/main' into fix/christopherk/issu…
chrisknvidia Sep 21, 2026
c3b0ff9
fix(analyzer): honor shell argument evaluation order
chrisknvidia Sep 21, 2026
995d746
fix(analyzer): invalidate effectful subprocess receivers
chrisknvidia Sep 21, 2026
5b0b469
fix(analyzer): invalidate receiver trust after generic calls
chrisknvidia Sep 23, 2026
d797826
Merge current main into fix/christopherk/issue-475-shell-truthiness-core
chrisknvidia Sep 23, 2026
75d1827
fix(analyzer): reconcile bound shell ownership
chrisknvidia Sep 23, 2026
650de7e
fix(analyzer): reconcile true-prefixed shell ownership
chrisknvidia Sep 23, 2026
434ff24
Merge current main into fix/christopherk/issue-475-shell-truthiness-core
chrisknvidia Sep 23, 2026
256a7ea
Merge upstream main into issue-475 shell truthiness core
chrisknvidia Sep 23, 2026
f7d9398
Merge current main into issue-475 shell truthiness core
chrisknvidia Sep 28, 2026
c6f6b28
fix(analyzer): invalidate nested RHS receiver effects
chrisknvidia Sep 28, 2026
1b9db61
Merge current main into issue-475 shell truthiness core
chrisknvidia Sep 28, 2026
fce761c
fix(analyzer): invalidate unsupported eager receiver effects
chrisknvidia Sep 28, 2026
08a1caa
fix(analyzer): track eager receiver state
chrisknvidia Sep 28, 2026
9d430d1
fix(analyzer): preserve lexical TM1 when dataflow abstains
chrisknvidia Oct 5, 2026
d3a137d
fix(analyzer): require a retained companion owner
chrisknvidia Oct 5, 2026
5919984
fix(analyzer): preserve execution scope in binding evidence
chrisknvidia Oct 5, 2026
2f89a69
test(analyzer): distinguish deferred abstention from lexical signal
chrisknvidia Oct 5, 2026
60025f8
style(analyzer): simplify binding event deduplication
chrisknvidia Oct 5, 2026
4dc0fab
fix: preserve runtime and retained shell evidence
chrisknvidia Oct 5, 2026
dd465f0
fix(analyzer): preserve called-slot identity and cached method evidence
chrisknvidia Oct 5, 2026
73e455c
fix: preserve cached subprocess slot state across scoped imports
chrisknvidia Oct 5, 2026
5437dba
fix(analyzer): reconcile explicit cached-slot evidence across scopes
chrisknvidia Oct 5, 2026
29ff7ec
Integrate current main with reviewed Python analyzer changes
chrisknvidia Oct 5, 2026
a3d502d
fix: abstain from cached slot proof after eager effects
chrisknvidia Oct 5, 2026
40b6890
test: retain lexical findings after unknown cached-slot effects
chrisknvidia Oct 5, 2026
8ac610d
fix: bound direct called-slot evidence to known execution order
chrisknvidia Oct 5, 2026
f56ee13
fix: limit direct slot proof to single assignment targets
chrisknvidia Oct 5, 2026
c9cf37b
fix: invalidate slot evidence on protocols and unsafe releases
chrisknvidia Oct 5, 2026
d897f14
fix: keep legacy shadow proof isolated from later effects
chrisknvidia Oct 5, 2026
3af2e93
fix: abstain from cached replacement proof after unknown effects
chrisknvidia Oct 5, 2026
30a1e41
fix: retain native callable detection across cached slot stores
chrisknvidia Oct 5, 2026
6b308ee
fix: retain shell findings for native receiver assignments
chrisknvidia Oct 5, 2026
64f3453
fix: preserve native Popen replacement warnings
chrisknvidia Oct 5, 2026
4c41790
Merge current main into fix/christopherk/issue-475-shell-truthiness-core
rng1995 Oct 8, 2026
fae399c
fix(analyzer): require proven replacement before revoking lexical TM1
rng1995 Oct 8, 2026
2c8e480
test: account for TM1 Python parsing in marker ownership ledger
rng1995 Oct 8, 2026
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
71 changes: 56 additions & 15 deletions src/skillspector/nodes/analyzers/static_patterns_tool_misuse.py
Original file line number Diff line number Diff line change
Expand Up @@ -2564,6 +2564,26 @@ def _line_containing(content: str, start: int, end: int) -> str:
return content[line_start:line_end]


def _classify_tm1(
context: str,
matched_text: str,
matched_line: str,
confidence: float,
file_type: str,
) -> tuple[Severity, float]:
"""Apply the existing TM1 contextual classification to one candidate."""
if (
_is_safe_container_command(context)
or _is_safe_dockerfile_idiom(context, matched_text)
or _is_safe_cache_cleanup(matched_line)
):
return Severity.LOW, min(confidence, 0.15)
adjusted = (
min(1.0, confidence + 0.1) if file_type in ("python", "shell", "javascript") else confidence
)
return Severity.HIGH, adjusted


def analyze(content: str, file_path: str, file_type: str) -> list[AnalyzerFinding]:
"""Analyze content for tool misuse patterns (TM1–TM3)."""
findings: list[AnalyzerFinding] = []
Expand All @@ -2583,20 +2603,13 @@ def ctx(start: int) -> str:
matched = matched_text[:200]
matched_line = _line_containing(content, match_start, match_end)

if (
_is_safe_container_command(context_text)
or _is_safe_dockerfile_idiom(context_text, matched)
or _is_safe_cache_cleanup(matched_line)
):
adj = min(confidence, 0.15)
sev = Severity.LOW
else:
adj = (
min(1.0, confidence + 0.1)
if file_type in ("python", "shell", "javascript")
else confidence
)
sev = Severity.HIGH
sev, adj = _classify_tm1(
context_text,
matched,
matched_line,
confidence,
file_type,
)
candidate_key = (line_num, " ".join(matched.strip().split()))
existing = tm1_findings_by_key.get(candidate_key)
if existing is not None:
Expand Down Expand Up @@ -2691,6 +2704,34 @@ def ctx(start: int) -> str:

def node(state: SkillspectorState) -> AnalyzerNodeResponse:
"""Run tool_misuse patterns and return findings."""
response = static_runner.run_static_patterns_with_ledger(state, [sys.modules[__name__]])
from . import static_python_shell_truthiness

response = static_runner.run_static_patterns_with_ledger(
state,
[sys.modules[__name__], static_python_shell_truthiness],
)
file_cache = state.get("file_cache", {})
for finding in response["findings"]:
if (
finding.evidence.pop(
static_python_shell_truthiness.BOUND_SHELL_EVIDENCE,
None,
)
is not True
):
continue
content = file_cache.get(finding.file, "")
content_lines = content.splitlines()
line_index = max(0, finding.start_line - 1)
matched = (finding.matched_text or "")[:200]
matched_line = content_lines[line_index] if line_index < len(content_lines) else matched
severity, finding.confidence = _classify_tm1(
finding.context or "",
matched,
matched_line,
finding.confidence,
"python",
)
finding.severity = severity.value
logger.info("%s: %d findings", ANALYZER_ID, len(response["findings"]))
return response
Loading
Loading