Skip to content

security(meta_analyzer): preserve high-severity static findings from LLM suppression#54

Merged
rng1995 merged 1 commit into
NVIDIA:mainfrom
AbhiramDwivedi:pr/d-meta-analyzer-suppression-floor
Jun 24, 2026
Merged

security(meta_analyzer): preserve high-severity static findings from LLM suppression#54
rng1995 merged 1 commit into
NVIDIA:mainfrom
AbhiramDwivedi:pr/d-meta-analyzer-suppression-floor

Conversation

@AbhiramDwivedi

@AbhiramDwivedi AbhiramDwivedi commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

Closes #59

What

meta_analyzer.apply_filter() previously kept a static finding only if the LLM echoed it back as is_vulnerability=True with confidence ≥ 0.6 — so any finding the LLM omitted or denied was silently dropped, regardless of severity.

Because the LLM's input includes attacker-controlled skill content, a prompt-injection payload could make the LLM drop a real CRITICAL/HIGH static finding, hiding it from the report (a false negative in a security gate). This affects all providers.

Fix (severity-gated floor)

  • CRITICAL/HIGH static findings are always kept. If the LLM confirms one, it's enriched as before; if not, the original finding is preserved and tagged llm-unconfirmed (now surfaced in Finding.to_dict() / JSON output).
  • MEDIUM/LOW keep the existing LLM false-positive filtering.
  • Rationale: in a security gate, a false negative (hiding a real CRITICAL) is far worse than a false positive.

Test

New tests cover CRITICAL/HIGH preserved+tagged, MEDIUM/LOW still filtered, confirmed-CRITICAL still enriched, and the tag surfacing via to_dict().

🤖 Generated with Claude Code

CRITICAL and HIGH static findings are now always kept in the output of
apply_filter(), even when the LLM does not confirm them (omitted, denies the
finding, or returns confidence < 0.6). MEDIUM/LOW findings continue to be
filtered by the LLM for false-positive reduction as before.

Motivation: the LLM receives attacker-controlled skill content. A prompt-
injection payload embedded in a scanned skill could cause the LLM to drop a
real CRITICAL or HIGH static finding, hiding it from the security report
(a false negative in a security gate). This invariant applies to all providers.

Implementation:
- LLMMetaAnalyzer._HIGH_SEVERITY_FLOOR = frozenset({"CRITICAL", "HIGH"}).
- In the "not confirmed" branch of apply_filter(), if the finding's severity is
  in the floor set, emit the original static finding unchanged and append the
  tag "llm-unconfirmed" so consumers can distinguish it from LLM-validated
  findings. The tag is not duplicated if already present.
- Confirmed CRITICAL/HIGH findings are still enriched with LLM explanation/
  remediation/confidence as before (no regression).
- Finding.to_dict() now includes "tags", so the "llm-unconfirmed" marker is
  visible in the JSON report (tags were previously not serialized).

Tests in tests/nodes/test_llm_analyzer_base.py:
- CRITICAL/HIGH finding unconfirmed -> kept, "llm-unconfirmed" tag, original data.
- MEDIUM/LOW finding unconfirmed    -> still dropped (existing behaviour).
- Confirmed CRITICAL               -> enriched normally, tag absent.
- Duplicate-tag guard              -> "llm-unconfirmed" not appended twice.
- to_dict surfacing               -> marker present in JSON output.

Signed-off-by: Ram Dwivedi <abhiram.dwivedi@yahoo.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

@rng1995 rng1995 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review: APPROVE

This is a well-reasoned fix for a real false-negative risk: because the LLM filter operates on attacker-controlled skill content, a prompt-injection payload could make it deny/omit a genuine high-severity static finding, and the old else: continue would silently drop it. Gating CRITICAL/HIGH static findings behind a preservation floor is the right call for a security gate.

Correctness

  • The new branch lives entirely inside the existing else (the "not LLM-confirmed" path) and appends its own preserved Finding before continue, so it doesn't disturb the confirmed-enrichment path below. Confirmed CRITICAL/HIGH findings still take the enrichment route (verified by test_critical_confirmed_uses_llm_enrichment).
  • The llm-unconfirmed tag is de-duplicated (if "llm-unconfirmed" not in unconfirmed_tags), and the original severity/message/confidence are preserved rather than overwritten with LLM values — exactly what you want for an unvalidated-but-retained finding.
  • MEDIUM/LOW continue to be filtered as before; the floor is scoped to the two severities where a missed detection is most damaging.

Security

  • Closes the stated suppression bypass without opening a new one: the floor is unconditional for CRITICAL/HIGH and independent of the LLM's is_vulnerability/confidence output, so injection can no longer hide those findings. Consumers can still tell validated vs. preserved findings apart via the tag.

Tests

  • Good coverage: CRITICAL denied, HIGH omitted, MEDIUM/LOW still dropped, confirmed-CRITICAL still enriched, tag de-dup, and tag surfacing through to_dict(). The assertions match the described behavior.

Minor / optional (non-blocking)

  • By design this widens the report surface (legitimately LLM-dismissed high-sev statics are now retained). That's the correct trade-off here, and the llm-unconfirmed tag mitigates it — just worth ensuring downstream consumers/severity gates treat the tag meaningfully rather than double-counting.
  • The floor compares f.severity against a frozenset of string literals. Worth a quick confirm that severity is the same type in production as in the tests (plain string vs. a str-based enum) so the membership check can never silently miss; the current tests construct it as a string.
  • to_dict() now always emits list(self.tags); fine as long as tags is guaranteed non-None for every Finding (it appears to default to a list).

Solid, minimal, and safe. Approving.

@rng1995
rng1995 merged commit 38ea6f9 into NVIDIA:main Jun 24, 2026
AbhiramDwivedi added a commit to AbhiramDwivedi/SkillSpector that referenced this pull request Jun 24, 2026
Resolve conflicts so the (approved) agent-CLI providers PR sits on the
latest main. Both feature sets are preserved side by side:

- NVIDIA#52: local agent-CLI providers (claude/codex/gemini, antigravity disabled),
  the AgentCLIChatModel adapter, and the LLM silent-degradation signal
  (llm_call_log telemetry -> report llm_degraded / fail-closed CAUTION floor /
  SARIF toolExecutionNotifications).
- main: anthropic_proxy provider, the provider model-resolution refactor
  (MODEL_CONFIG -> provider.resolve_model()), baseline/suppression,
  SARIF rules[] + suppressions, and analysis_completeness.

Notable resolutions:
- get_chat_model: CLI branch defaults the model via provider.resolve_model()
  (MODEL_CONFIG was removed upstream); HTTP branch keeps _resolve_default_chat_model().
- meta_analyzer failure path: upstream's fail-closed _passthrough_with_defaults
  plus NVIDIA#52's ok=False degradation record.
- report: _build_sarif takes both suppressed and degraded_notice; _build_metadata
  merges meta_analysis_applied/filtering_mode with the degradation fields
  (a degraded scan is no longer counted as meta_analysis_applied).
- Adjusted two pre-existing meta_analyzer filter tests to use a sub-floor
  (MEDIUM) severity so they exercise the drop path; CRITICAL/HIGH are kept by
  PR NVIDIA#54's severity floor regardless of LLM verdict.

Signed-off-by: Ram Dwivedi <abhiram.dwivedi@yahoo.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

security: LLM meta-analysis can suppress high-severity static findings via prompt injection

2 participants