Inferensys

Prompt

Transitive Dependency Vulnerability Reachability Prompt

A practical prompt playbook for security engineers assessing whether a reported CVE in a transitive dependency is actually exploitable in their application. Produces a reachability analysis by tracing call paths from application code through the dependency graph, with confidence scoring and evidence citation.
Developer doing prompt engineering on laptop, prompt variations visible on screen, casual coding session.
PROMPT PLAYBOOK

When to Use This Prompt

Understand the job-to-be-done, ideal user, required context, and when not to use this reachability prompt.

Security scanners flag CVEs in transitive dependencies constantly. Most are not exploitable in your specific application because the vulnerable function is never called, the vulnerable code path is unreachable, or compensating controls neutralize the risk. This prompt takes a CVE advisory, your application's dependency graph, and relevant source code to produce a structured reachability assessment. Use it when you need to prioritize hundreds of dependency alerts and cannot manually trace each call path. The ideal user is a security engineer or platform engineer who understands the application's architecture and can provide accurate dependency graphs and source snippets. Without this context, the model cannot produce a reliable assessment.

The prompt requires three concrete inputs to function: a CVE advisory with the vulnerable package, version range, and vulnerable function signatures; a dependency graph showing how the vulnerable package is pulled into your application, including all intermediate packages in the transitive chain; and source code snippets from your application that import or use the affected dependency, even indirectly. The model traces call paths from your code through the dependency graph to determine if the vulnerable function is ever invoked. It produces a confidence-scored assessment with specific evidence citations for each call path analyzed. This is not a replacement for static analysis tools or runtime profiling—it is a triage accelerator that helps you focus manual review effort on the dependencies that actually matter.

Do not use this prompt as the sole decision-maker for production-blocking remediation. A 'not reachable' finding from this prompt should never be the only evidence used to close a critical or high-severity vulnerability ticket. Always require human review for high-severity findings and validate call path evidence against actual code before dismissing a vulnerability. The model can miss indirect call paths through reflection, dynamic dispatch, dependency injection frameworks, or runtime configuration. It also cannot assess vulnerabilities triggered by data flow rather than control flow, such as deserialization gadgets or prototype pollution chains. For those cases, supplement this prompt with dynamic analysis or manual code review. Use this prompt to reduce the triage queue from hundreds of alerts to the handful that warrant deep investigation.

PRACTICAL GUARDRAILS

Use Case Fit

Where the Transitive Dependency Vulnerability Reachability Prompt works and where it does not. This prompt is designed for deep, evidence-backed analysis, not high-volume triage.

01

Good Fit: Deep-Dive Investigation

Use when: A critical or high-severity CVE is reported in a library you don't call directly, and you need to prove or disprove exploitability before patching. Guardrail: The prompt requires a specific CVE ID and access to the codebase's call graph or dependency tree to function correctly.

02

Bad Fit: Bulk CVE Triage

Avoid when: You have a list of 50 new CVEs from a weekly advisory and need a quick pass/fail. Guardrail: This prompt is too expensive and slow for bulk triage. Use a lightweight classification prompt first to filter for potentially reachable vulnerabilities, then apply this deep analysis only to the survivors.

03

Required Inputs

What to watch: The prompt cannot function without a specific CVE ID, the vulnerable package name and version, and a representation of your application's dependency graph. Guardrail: If you cannot provide the full path from your root dependencies to the vulnerable package, the analysis will be incomplete. The prompt should refuse to speculate without this data.

04

Operational Risk: False Confidence

What to watch: The model may report a vulnerability as 'unreachable' due to an incomplete call graph or an inability to reason about reflection, dynamic class loading, or native code paths. Guardrail: The output must include a confidence score and explicitly list the analysis limitations. A human security engineer must sign off on any 'unreachable' verdict for a critical vulnerability.

05

Operational Risk: Stale Evidence

What to watch: The prompt analyzes a snapshot of the dependency graph. If the codebase or dependencies change, the analysis is invalid. Guardrail: Tie the analysis to a specific git commit hash and dependency lock file. Automate re-analysis on every lock file change in CI/CD for critical paths.

06

Variant: Runtime Exploitability

What to watch: A vulnerability might be reachable in code but not exploitable at runtime due to security controls, input validation, or sandboxing. Guardrail: This prompt focuses on code-path reachability. A separate, follow-up prompt should assess runtime exploitability by analyzing the specific call site's input sources, guards, and the application's security architecture.

PROMPT PLAYBOOK

Copy-Ready Prompt Template

A ready-to-adapt prompt template for assessing whether a reported CVE in a transitive dependency is actually exploitable in your application.

This prompt template is designed to be pasted directly into your AI workflow. It instructs the model to act as a security engineer, tracing call paths from your application code through the dependency graph to determine if a specific CVE is reachable. The template uses square-bracket placeholders for all dynamic inputs—replace these with real data from your codebase, package manifests, and vulnerability scanners before execution. The output is a structured reachability analysis with a confidence score and evidence citations, making it suitable for integration into a security review pipeline or ticketing system.

text
You are a senior application security engineer. Your task is to perform a reachability analysis for a reported CVE in a transitive dependency.

## INPUT DATA
- **Application Code (relevant excerpts):**
  [APPLICATION_CODE]
- **Dependency Graph (from lock file or SBOM):**
  [DEPENDENCY_GRAPH]
- **CVE Details:**
  [CVE_DETAILS]
- **Known Safe Patterns (functions/versions not affected):**
  [SAFE_PATTERNS]

## CONSTRAINTS
- Only analyze call paths that originate from [APPLICATION_CODE].
- Do not assume exploitability without a concrete, traceable call path.
- If the vulnerable function is imported but never called, classify it as "Unreachable."
- If the vulnerable code path requires a specific configuration that is not present, note this as a mitigating factor.
- Cite specific file paths, function names, and line numbers as evidence.

## OUTPUT SCHEMA
Return a valid JSON object with the following structure:
{
  "cve_id": "string",
  "package_name": "string",
  "vulnerable_version": "string",
  "installed_version": "string",
  "reachability_assessment": "Reachable | Potentially Reachable | Unreachable | Insufficient Evidence",
  "confidence_score": 0.0-1.0,
  "call_paths": [
    {
      "path": ["file.function()", "...", "vulnerable_function()"],
      "evidence": "string describing how this path was determined",
      "requires_user_input": true/false,
      "requires_specific_config": true/false
    }
  ],
  "mitigating_factors": ["string"],
  "remediation_priority": "Critical | High | Medium | Low | Informational",
  "summary": "string"
}

## RISK LEVEL
[RISK_LEVEL]

## EXAMPLES
[EXAMPLES]

To adapt this template, start by replacing [APPLICATION_CODE] with the specific files or functions that import or use the affected dependency. The [DEPENDENCY_GRAPH] should be a machine-readable representation of your full dependency tree, such as the output of npm ls --all or a CycloneDX SBOM. For [CVE_DETAILS], paste the full CVE record including the vulnerable function names, version ranges, and attack vector. The [RISK_LEVEL] placeholder should be set to the context's risk tolerance, which influences the model's remediation priority. The [EXAMPLES] placeholder can be populated with one or two few-shot examples of correct analyses to improve consistency. After generating the output, always validate the JSON structure and verify that each cited call path exists in your actual codebase—this is a high-risk workflow where hallucinated paths can lead to wasted remediation effort or a false sense of security.

IMPLEMENTATION TABLE

Prompt Variables

Each placeholder required by the Transitive Dependency Vulnerability Reachability Prompt, its purpose, an example value, and validation notes for integration.

PlaceholderPurposeExampleValidation Notes

[CVE_ID]

The specific CVE identifier to analyze for reachability.

CVE-2024-3094

Must match CVE-ID regex pattern. Reject if not found in NVD or OSV.

[PACKAGE_NAME]

The name of the vulnerable transitive dependency.

xz-utils

Must be an exact match for a package in the lock file. Case-sensitive check required.

[PACKAGE_VERSION]

The installed version of the vulnerable package in the lock file.

5.6.0

Must be a valid semver string. Compare against lock file to confirm presence.

[LOCK_FILE_CONTENT]

The full content of the project's dependency lock file.

package-lock.json contents

Must be valid JSON or TOML. Validate parse succeeds before prompt assembly.

[APPLICATION_CODE_PATHS]

Relevant application source files that may import or use the vulnerable dependency.

src/auth/validator.js

Each path must exist in the repository. Provide only files with import statements.

[CALL_GRAPH_SNIPPET]

A pre-computed call graph fragment showing paths from application code to the vulnerable function.

app.login() -> lib.parse() -> xz.decompress()

Must be a valid directed path. If unavailable, set to null and note lower confidence.

[ADVISORY_DETAILS]

The full text of the security advisory or CVE description.

CVE-2024-3094: Malicious code in xz-utils 5.6.0 allows...

Must contain the CVE ID and vulnerability description. Truncation allowed only at sentence boundaries.

[CONFIDENCE_THRESHOLD]

Minimum confidence score (0.0-1.0) required for the model to assert reachability.

0.85

Must be a float between 0.0 and 1.0. Lower values increase false positives; higher values increase false negatives.

PROMPT PLAYBOOK

Implementation Harness Notes

How to wire the Transitive Dependency Vulnerability Reachability Prompt into a security review pipeline or CI/CD workflow.

This prompt is designed to operate as a gated analysis step within a CI/CD pipeline or a periodic security scanning workflow, not as a one-off chat interaction. The harness must receive a structured input payload containing the CVE identifier, the affected package name and version, the project's full dependency graph (from a lock file or SBOM), and a set of call path snippets extracted from the application codebase. The prompt's output—a reachability assessment with a confidence score and evidence citations—should be treated as a machine-readable signal that feeds into a vulnerability management system, not as a final human-readable report. The implementation must enforce strict input validation before the prompt is ever called, ensuring that the dependency graph is complete and that the call path extraction has been performed by a deterministic static analysis tool, not by the model itself.

Wire the prompt into your workflow by first building a pre-processing step that uses a tool like grep, semgrep, or a language-specific call graph analyzer to find all import statements and function invocations that touch the vulnerable package or its dependents. This evidence must be packaged into the [CALL_PATH_EVIDENCE] placeholder as a structured list of file paths, line numbers, and function signatures. The prompt should be called with a model that supports structured output (JSON mode) and a low temperature setting (0.0–0.1) to maximize deterministic behavior. Implement a post-processing validator that checks the output schema for required fields (reachability_assessment, confidence_score, evidence_citations, analysis_summary), rejects any response with a confidence score below a configurable threshold (e.g., 0.7) for manual review, and logs the full prompt and response payload for auditability. For high-risk findings, route the result to a human security engineer via a ticketing system or approval queue before any automated suppression or closure occurs.

Avoid wiring this prompt directly to raw lock files without pre-processing. The model cannot reliably perform static analysis on large dependency graphs; it will hallucinate call paths if asked to invent them. Instead, treat the prompt as a reasoning engine over pre-computed evidence. Implement retries with exponential backoff for transient API failures, but do not retry on validation failures—those should escalate immediately. For production deployments, consider caching results per unique (CVE, package, version, call-path-hash) tuple to avoid redundant API calls. The next step after implementation is to build a regression test suite using known-vulnerable and known-safe dependency configurations to measure the prompt's false-positive and false-negative rates before enabling it as a blocking gate in your merge or release pipeline.

IMPLEMENTATION TABLE

Expected Output Contract

Structured output fields, types, and validation rules for the reachability analysis response. Each field must pass the specified validation before the output is accepted by the downstream system.

Field or ElementType or FormatRequiredValidation Rule

vulnerability_id

string (CVE format)

Must match regex ^CVE-\d{4}-\d{4,}$ and match the [CVE_ID] input exactly

reachability_status

enum string

Must be one of: 'reachable', 'unreachable', 'potentially_reachable', 'insufficient_evidence'. No other values allowed.

confidence_score

float (0.0-1.0)

Must be between 0.0 and 1.0 inclusive. If reachability_status is 'insufficient_evidence', confidence_score must be <= 0.5.

call_paths

array of objects

Each object must contain 'path_sequence' (array of strings), 'entry_point' (string matching a file in [CODEBASE_CONTEXT]), and 'evidence_type' (enum: 'static_analysis', 'runtime_trace', 'dependency_graph', 'heuristic'). Array must be empty if reachability_status is 'unreachable'.

affected_components

array of strings

Each string must match a module, package, or service name present in [DEPENDENCY_GRAPH]. Array must be empty if reachability_status is 'unreachable'.

exploitability_assessment

string

Must be non-empty and contain at least one sentence referencing a specific precondition from [CVE_DETAILS]. Must not exceed 500 words.

evidence_citations

array of objects

Each object must contain 'source' (string matching a file path or document reference in [CODEBASE_CONTEXT] or [DEPENDENCY_GRAPH]), 'snippet' (string, max 200 chars), and 'relevance' (string explaining why this evidence supports the reachability determination). Array must be non-empty unless reachability_status is 'insufficient_evidence'.

remediation_guidance

string or null

If reachability_status is 'reachable' or 'potentially_reachable', this field is required and must contain a non-empty string with at least one actionable step. If 'unreachable', must be null. If 'insufficient_evidence', may contain investigation steps or be null.

PRACTICAL GUARDRAILS

Common Failure Modes

What breaks first when running transitive dependency vulnerability reachability analysis in production and how to guard against it.

01

False Negatives from Incomplete Call Graphs

What to watch: The model reports a vulnerability as unreachable because the static analysis tool or dependency graph missed a dynamic call path, reflection-based invocation, or framework-level routing. Guardrail: Require the prompt to flag uncertainty when call graphs are incomplete and cross-reference with runtime instrumentation data where available.

02

False Positives from Over-Approximation

What to watch: The model traces a theoretical call path that cannot execute in practice due to feature flags, dead code, or environment-specific guards. Guardrail: Add a constraint requiring the model to check whether each traced path is gated by configuration, build tags, or runtime conditions before confirming reachability.

03

Version Drift Between Analysis and Reality

What to watch: The prompt analyzes a dependency version from a lock file or SBOM, but the deployed artifact uses a different resolved version due to build-time resolution or container layering. Guardrail: Include a pre-check step that validates the analyzed version against the actual deployed artifact hash or runtime manifest before accepting reachability conclusions.

04

Confidence Inflation on Ambiguous Paths

What to watch: The model assigns high confidence to a reachability judgment based on partial evidence, especially when the call path involves multiple indirection layers or dependency injection frameworks. Guardrail: Require the output schema to include a confidence score per traced path and a mandatory low-confidence flag when the path crosses more than two indirection boundaries without explicit invocation evidence.

05

Ignoring Transitive Shading and Relocation

What to watch: The vulnerable package is shaded, relocated, or repackaged inside another dependency, making the standard package name and version mismatch the actual code on the classpath. Guardrail: Add a pre-analysis instruction to check for shaded copies of known vulnerable packages in the dependency tree and flag them even when the direct dependency name does not appear.

06

Missing Evidence Citations for Audit Trail

What to watch: The model produces a reachability conclusion without citing the specific file paths, line numbers, or call chain entries that support the judgment, making the output unauditable for compliance or incident review. Guardrail: Enforce structured evidence output with mandatory source locations for each call graph edge and a validation check that rejects responses missing citation anchors.

IMPLEMENTATION TABLE

Evaluation Rubric

Use this rubric to test output quality before deploying the Transitive Dependency Vulnerability Reachability Prompt into your security pipeline. Each criterion targets a specific failure mode common to reachability analysis.

CriterionPass StandardFailure SignalTest Method

Call Path Completeness

Output traces a full call path from application code through at least one intermediate dependency to the vulnerable function, with file paths and function names cited.

Path ends at a direct dependency without traversing into the transitive layer, or path is described only in general terms without specific code references.

Provide a known-reachable CVE in a test project. Verify the output includes a chain of at least 3 nodes ending at the vulnerable function.

Evidence Grounding

Every claim about call path, exploitability, or mitigating controls cites a specific source: code file, import statement, lock file entry, or advisory field.

Output contains phrases like "likely reachable" or "probably exploitable" without linking to a specific code location, import, or advisory detail.

Scan the output for unsupported assertions. Require each reachability claim to reference a grep-able code location or a named advisory field.

Confidence Score Calibration

Confidence score is provided per finding and decreases when the call path includes dynamic dispatch, reflection, or unevaluated conditional branches.

Confidence is uniformly high across all findings, or no confidence score is provided at all.

Test with a CVE behind a feature flag or runtime conditional. Verify the confidence score is lower than a directly invoked vulnerable function.

False Positive Rejection

Output correctly identifies when a vulnerable function is present in the dependency graph but not importable or callable from application code, and marks it as unreachable.

Output flags a vulnerability as reachable solely because the vulnerable package is in the lock file, without verifying an import chain exists.

Use a test project that includes a vulnerable transitive dependency but never imports it. Verify the output classifies it as unreachable.

Mitigating Control Recognition

Output identifies compensating controls that block exploitability: input validation, sandboxing, authentication gates, or network isolation, and explains how they reduce risk.

Output ignores application-level guards and treats all reachable paths as equally exploitable.

Test with a CVE reachable only through an authenticated admin endpoint. Verify the output notes the authentication requirement as a mitigating control.

Output Schema Compliance

Output matches the defined [OUTPUT_SCHEMA] exactly: all required fields present, correct types, no extra fields, enums match allowed values.

Output is missing required fields, contains malformed JSON, uses wrong types, or includes hallucinated fields not in the schema.

Validate output against the JSON Schema definition. Require 100% structural compliance. Fail on any schema violation.

Advisory-to-Code Mapping Accuracy

Output correctly maps the CVE identifier to the specific vulnerable function and version range, and confirms the installed version falls within the affected range.

Output maps a CVE to the wrong function, misidentifies the affected version range, or flags a CVE for a version already patched.

Test with a CVE where the installed version is one patch above the fix. Verify the output correctly excludes it. Test with a version inside the range and verify inclusion.

ADAPTATION OPTIONS

Adapt This Prompt

How to adapt

Use the base prompt with a single model call and manual review of the output. Focus on getting the reachability reasoning right before adding tool integration. Start with a static dependency graph provided inline rather than live SBOM or call-graph tool output.

  • Replace [DEPENDENCY_GRAPH] with a manually extracted subgraph from npm ls or pipdeptree.
  • Replace [CVE_DETAILS] with the advisory description and affected version range.
  • Set [CONFIDENCE_THRESHOLD] to a lower value (e.g., 0.5) to surface more candidates for manual triage.
  • Remove the [EVIDENCE_CITATION] requirement initially; add it back once the reasoning chain stabilizes.

Watch for

  • The model hallucinating call paths that don't exist in the actual codebase.
  • Overly broad "potentially reachable" classifications that flag everything.
  • Missing the distinction between dev dependencies and production dependencies.
  • Confusing vulnerable function signatures with actual invocation patterns.
Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.