Security engineering teams face a common bottleneck: a backlog of hundreds or thousands of static analysis findings, all marked 'High' or 'Critical' by the tool, with no way to distinguish the one finding that could lead to a breach from the hundred that are unreachable in production. This prompt ranks SAST findings by actual risk using exploitability, reachability, asset criticality, and existing mitigations rather than raw severity scores. Use it when you need a prioritized remediation queue that reflects real-world impact, not tool defaults.
Prompt
Risk Ranking Prompt for SAST Findings

When to Use This Prompt
Understand the job-to-be-done, ideal user, required context, and when not to use this prompt.
The prompt expects structured finding data and deployment context. You must supply a list of findings with fields like finding ID, rule ID, severity, file path, and line number. You also need deployment context: whether the affected code is reachable in production, the asset's criticality tier, any existing mitigations like WAF rules or network segmentation, and the data classification level. The prompt works best when findings are pre-deduplicated and false positives are already filtered out. It does not replace human security review for novel vulnerability classes, architecture-level threats, or findings where exploitability cannot be determined from static context alone.
Do not use this prompt as a substitute for a threat model or a penetration test. It ranks known findings, not unknown risks. If your input data lacks deployment context, the prompt will default to conservative rankings that may not improve over tool defaults. Wire the output into your ticketing system or remediation pipeline, but always include a human review gate for findings ranked above a defined risk threshold. The next section provides the copy-ready prompt template you can adapt with your own finding schema and risk taxonomy.
Use Case Fit
Where the Risk Ranking Prompt for SAST Findings delivers value and where it introduces unacceptable risk. Use these cards to decide if this prompt fits your workflow before integrating it into a production triage pipeline.
Good Fit: Large Backlogs with Mixed Severity
Use when: You have hundreds or thousands of SAST findings and need to prioritize remediation beyond raw CVSS or tool severity scores. Why it works: The prompt synthesizes exploitability, reachability, asset criticality, and existing mitigations into a risk-ranked list that reflects actual organizational impact, not just theoretical severity.
Bad Fit: Single-Finding or Real-Time Blocking Decisions
Avoid when: You need a binary merge/don't-merge decision on a single finding in a CI/CD pipeline. Why it fails: This prompt is designed for batch prioritization and contextual reasoning. For real-time gating, use a Static Analysis Triage Decision Prompt with strict policy rules and no ambiguity.
Required Inputs: Context Beyond the SARIF File
What to watch: Ranking quality collapses if the prompt only receives raw finding data without deployment context, asset classification, or network reachability information. Guardrail: Always provide [ASSET_CRITICALITY], [DEPLOYMENT_CONTEXT], [NETWORK_EXPOSURE], and [EXISTING_MITIGATIONS] as structured inputs alongside the findings list.
Operational Risk: Confidence Overstatement
What to watch: The model may assign high confidence to rankings based on incomplete or inferred context, especially when reachability or exploitability data is missing. Guardrail: Require the output to include a confidence field per finding and flag any ranking where confidence is low or uncertain for human review before committing to remediation timelines.
Operational Risk: Stale Context Drift
What to watch: Asset criticality, deployment topology, and mitigations change over time. A ranking generated last week may be dangerously wrong today after a service promotion or firewall rule change. Guardrail: Never cache rankings. Regenerate on each triage cycle with fresh context inputs and timestamp the output for auditability.
Bad Fit: Unreviewed Compliance Reporting
Avoid when: The output will be used directly in audit evidence or regulatory submissions without human review. Why it fails: Ranking rationale may contain subtle errors, omitted context, or language that does not meet compliance documentation standards. Guardrail: Always route ranked output through a human security engineer for approval before it enters any compliance artifact or external report.
Copy-Ready Prompt Template
A production-ready prompt template for ranking SAST findings by actual risk, ready to paste into your orchestration layer with placeholders for your specific tool output and deployment context.
This prompt template ingests raw SAST findings and produces a prioritized list ranked by exploitability, reachability, asset criticality, and existing mitigations rather than relying solely on the tool's default severity score. Replace each square-bracket placeholder with real data before sending to the model. The template expects structured input describing each finding's location, rule metadata, data flow context, and deployment environment. If your SAST tool does not provide reachability or asset context, populate those fields with available evidence or mark them as unknown—the model will adjust confidence accordingly.
textYou are a security engineering analyst reviewing static analysis findings. Your task is to rank findings by actual risk to the organization, not by raw severity scores. ## INPUT FINDINGS [FINDINGS_JSON_ARRAY] Each finding object contains: - finding_id: unique identifier - rule_id: SAST rule that fired - severity: tool-assigned severity (Critical/High/Medium/Low) - file_path: location in codebase - line_range: affected lines - description: what the rule detected - data_flow: taint source, propagation steps, and sink if available - reachability: whether the code path is reachable from an external entry point (Reachable/Unreachable/Unknown) - authentication_required: whether the endpoint or function requires authentication (Yes/No/Unknown) - input_controllability: degree to which an attacker controls input (Full/Partial/None/Unknown) - asset_criticality: criticality of the affected service or data store (Critical/High/Medium/Low/Unknown) - existing_mitigations: compensating controls already in place (WAF, input validation, sanitization, sandboxing, network segmentation, none, unknown) - deployment_environment: where the code runs (Production/Staging/Development/Internal-only) ## RANKING CRITERIA Rank findings by actual risk using this weighted framework: 1. Exploitability (40%): Combine reachability, authentication_required, and input_controllability. A finding reachable from an unauthenticated external endpoint with full attacker input control is highest risk. 2. Asset Impact (30%): Asset criticality and deployment environment. Production critical assets score highest. 3. Mitigation Defeat (20%): Existing mitigations that reduce or eliminate exploitability lower the risk score. 4. Severity Baseline (10%): Use tool severity as a starting point but never as the sole factor. ## OUTPUT FORMAT Return a JSON object with this exact structure: { "ranked_findings": [ { "rank": integer starting at 1, "finding_id": string, "risk_score": float between 0.0 and 100.0, "risk_category": "Critical" | "High" | "Medium" | "Low" | "Informational", "ranking_rationale": string explaining why this finding received this rank, referencing specific evidence from the input fields, "confidence": "High" | "Medium" | "Low", "confidence_factors": [string array of factors that increase or decrease confidence], "requires_human_review": boolean, "review_reason": string or null if human review not required } ], "ranking_summary": { "total_findings": integer, "critical_count": integer, "high_count": integer, "medium_count": integer, "low_count": integer, "informational_count": integer, "human_review_required_count": integer, "highest_risk_finding_id": string, "methodology_notes": string describing any assumptions or limitations in the ranking } } ## CONSTRAINTS - Never rank an unreachable finding above a reachable one with similar characteristics. - If confidence is Low, requires_human_review must be true. - If asset_criticality is Unknown, assume Medium and note this in confidence_factors. - If reachability is Unknown, treat as potentially reachable but lower confidence. - Do not invent evidence. Only use fields provided in the input. - If input fields are missing or null, note this in confidence_factors and adjust confidence downward. - Produce exactly one ranked_findings entry per input finding. Do not drop findings.
After pasting this template, replace [FINDINGS_JSON_ARRAY] with your actual SAST output serialized as a JSON array of finding objects. If your SAST tool does not natively produce fields like reachability or asset_criticality, you have two options: enrich the findings in your application layer before calling the model, or populate those fields with "Unknown" and accept lower confidence scores. For high-risk codebases, prefer enrichment. Wire the output through a JSON schema validator before consuming it in your ticketing or remediation workflow. If any finding returns requires_human_review: true, route it to a security engineer's queue rather than auto-assigning it to a developer. Test this prompt against a golden dataset of 20-30 findings with known risk rankings before deploying to production.
Prompt Variables
Required and optional inputs for the Risk Ranking Prompt. Each placeholder must be populated before the prompt is assembled and sent. Validation notes describe how to verify the input is well-formed before execution.
| Placeholder | Purpose | Example | Validation Notes |
|---|---|---|---|
[FINDING_LIST] | JSON array of SAST findings to rank. Each object must include finding_id, rule_id, severity, file_path, line_number, and message. | [{"finding_id": "SAST-001", "rule_id": "java/ssrf", "severity": "HIGH", "file_path": "src/api/DataFetcher.java", "line_number": 42, "message": "Untrusted URL flows to HTTP request"}] | Parse as JSON array. Reject if empty, null, or missing required fields. Minimum 1 finding, maximum 200 per batch. |
[DEPLOYMENT_CONTEXT] | Object describing where the affected code runs. Includes environment, network exposure, authentication boundary, and data classification. | {"environment": "production", "network_exposure": "internal", "authentication_required": true, "data_classification": "PII"} | Validate enum values for environment (production, staging, development). Reject if environment is null. Network exposure must be one of public, internal, isolated. |
[ASSET_CRITICALITY_MAP] | Mapping of service or repository names to criticality tiers. Used to weight findings by blast radius. | {"payment-service": "critical", "user-profile-service": "high", "internal-docs": "low"} | Parse as JSON object. Keys must match service names referenced in findings. Criticality must be one of critical, high, medium, low. Reject unknown tiers. |
[EXISTING_MITIGATIONS] | Array of compensating controls already in place. Each entry describes a control, its scope, and the findings it partially or fully mitigates. | [{"control": "WAF blocks SSRF to internal metadata endpoints", "scope": "all outbound HTTP from payment-service", "mitigates_rule_ids": ["java/ssrf"]}] | Parse as JSON array. Each entry must have control, scope, and mitigates_rule_ids. Null allowed if no mitigations exist. Validate rule_id references exist in [FINDING_LIST]. |
[REACHABILITY_DATA] | Object mapping finding_ids to reachability analysis results. Indicates whether the vulnerable code path is callable from untrusted input. | {"SAST-001": {"reachable_from_untrusted_input": true, "call_path_length": 3, "requires_authentication": true}} | Parse as JSON object. Keys must match finding_ids in [FINDING_LIST]. reachable_from_untrusted_input must be boolean. Null allowed if reachability analysis unavailable. |
[RANKING_POLICY] | Object defining organizational risk priorities. Specifies weights for exploitability, asset criticality, data sensitivity, and fix complexity. | {"exploitability_weight": 0.4, "asset_criticality_weight": 0.3, "data_sensitivity_weight": 0.2, "fix_complexity_weight": 0.1} | Parse as JSON object. Weights must sum to 1.0 within 0.01 tolerance. Each weight must be between 0.0 and 1.0. Reject if weights are null or missing keys. |
[CONFIDENCE_THRESHOLD] | Float between 0.0 and 1.0. Findings with confidence below this threshold are flagged for human review rather than auto-ranked. | 0.7 | Must be a number between 0.0 and 1.0 inclusive. Default 0.7 if not provided. Values below 0.5 trigger a warning that many findings will require human review. |
Implementation Harness Notes
Practical wiring instructions for integrating the risk ranking prompt into a security engineering workflow.
This prompt is designed to be a decision-support node inside a larger SAST triage pipeline, not a standalone chatbot. The primary integration point is after findings have been deduplicated and false positives filtered. The application should feed the prompt a batch of deduplicated, likely-true-positive findings, each enriched with asset context, and receive a ranked list with rationales. The output is consumed by a downstream routing system that assigns high-ranked findings to on-call engineers and low-ranked findings to a weekly review queue.
Input assembly is the most critical implementation step. Before calling the model, the harness must join each SAST finding with its deployment context: reachability data from the runtime environment, asset criticality from the CMDB or service catalog, and any existing mitigations from the WAF or network policy. This context is injected into the [FINDING_CONTEXT] placeholder. A strict JSON schema must be provided in [OUTPUT_SCHEMA] to enforce the ranked list structure, including required fields for rank, finding_id, risk_score, rationale_summary, and confidence. The [CONSTRAINTS] field should explicitly instruct the model to output only valid JSON matching the schema, with no additional commentary.
Validation and error handling must be implemented in the application layer. After receiving the model response, the harness must validate the JSON structure, confirm that all input finding_id values are present in the output, and check that risk_score values are within the expected range. If validation fails, implement a single retry with the error message injected into the [PREVIOUS_ERROR] field of the retry prompt. If the retry also fails, log the failure and route the batch to a human triage queue. Do not silently drop findings or proceed with a malformed ranking.
Model choice and latency are important trade-offs. For high-volume pipelines processing hundreds of findings per commit, use a fast, cost-effective model like claude-3-haiku or gpt-4o-mini with a strict token limit. For weekly deep-dive reviews of the top 10 findings across a monorepo, a more capable model like claude-3.5-sonnet or gpt-4o can produce richer rationales and higher-confidence exploitability assessments. Implement a feature flag to switch between model tiers based on the batch's risk profile or the consuming workflow's SLA.
Observability and audit are non-negotiable for security workflows. Log every prompt request and response, including the full input context, the raw model output, the validation result, and the final ranked list. Attach a unique trace_id to each batch so that downstream ticket creation and remediation tracking can be linked back to the ranking decision. This audit trail is essential for answering questions like 'Why was this critical finding ranked below that medium one?' during post-incident reviews or compliance audits.
Human-in-the-loop integration should be implemented as a review gate for high-risk or low-confidence rankings. If the model assigns a confidence score below a configurable threshold (e.g., 0.7) to any finding in the top 10, or if the risk_score gap between adjacent findings is very small, flag the batch for human review before routing. The review interface should display the original findings, the model's ranking and rationale, and allow a security engineer to reorder, override, or approve the list. This feedback can be logged and used to fine-tune the prompt or build evaluation datasets over time.
Expected Output Contract
Defines the shape, types, and validation rules for each field in the risk ranking output. Use this contract to build a parser, validator, or retry loop before the output reaches a downstream system or human reviewer.
| Field or Element | Type or Format | Required | Validation Rule |
|---|---|---|---|
ranked_findings | Array of objects | Must be a non-empty JSON array. If no findings are provided, return an empty array. | |
ranked_findings[].rank | Integer | Must be a positive integer starting at 1, sequential, and unique. No gaps or ties allowed. | |
ranked_findings[].finding_id | String | Must match a [FINDING_ID] from the input list. Validation fails if an ID is missing or invented. | |
ranked_findings[].risk_score | Number | Must be a float between 0.0 and 100.0 inclusive. Higher values indicate greater risk. | |
ranked_findings[].ranking_rationale | String | Must be 1-3 sentences referencing specific evidence from [CONTEXT] fields like reachability, asset criticality, or existing mitigations. Cannot be a generic restatement of the score. | |
ranked_findings[].confidence | String | Must be one of the enum values: 'high', 'medium', 'low'. Use 'low' when [CONTEXT] is missing key fields like exploitability or asset data. | |
ranked_findings[].top_risk_factors | Array of strings | Must contain 1-3 short labels from a controlled set: 'public_facing', 'no_auth_required', 'sensitive_data_exposed', 'no_mitigations', 'actively_exploited', 'critical_asset'. Custom labels are not allowed. | |
output_metadata.generated_at | String (ISO 8601) | If present, must be a valid UTC timestamp. Used for traceability in audit logs. |
Common Failure Modes
Risk ranking prompts fail in predictable ways that undermine triage decisions. These are the most common failure modes and how to guard against them.
Severity Score Anchoring
What to watch: The model defaults to the tool-assigned severity (Critical/High/Medium/Low) instead of independently assessing exploitability, reachability, and asset criticality. A High-severity finding in an unreachable debug endpoint gets ranked above a Medium-severity finding in a public-facing auth flow. Guardrail: Explicitly instruct the model to ignore raw severity labels and re-rank using only the risk dimensions you provide. Include a worked example where a Low-severity finding outranks a Critical one with clear justification.
Exploitability Overestimation
What to watch: The model assumes every finding is exploitable without requiring evidence of an attack path, controllable input, or missing sanitizers. This inflates risk scores and creates a backlog where everything looks urgent. Guardrail: Require the model to state explicit exploitability preconditions for each finding and downgrade findings where preconditions are unmet or blocked by existing controls. Add a confidence indicator when exploitability is inferred rather than confirmed.
Mitigation Blindness
What to watch: The model ignores compensating controls already in place—WAF rules, network segmentation, auth gates, input validation earlier in the pipeline—and ranks findings as if the vulnerable code is exposed directly to untrusted input. Guardrail: Include a dedicated [EXISTING_MITIGATIONS] input field and instruct the model to explicitly reason about each mitigation's effect on exploitability before assigning a final rank. Flag findings where mitigations are assumed absent due to missing data.
Asset Criticality Uniformity
What to watch: Without clear asset context, the model treats all services and code paths as equally critical. A finding in a billing service gets the same weight as a finding in an internal dashboard. Guardrail: Provide a structured [ASSET_CRITICALITY_MAP] with tiers (e.g., P0: customer data, P1: auth, P2: internal tools) and require the model to reference the tier in its ranking rationale. Reject rankings that don't cite asset criticality.
Confidence Inflation
What to watch: The model assigns high confidence to rankings even when key inputs are missing—no reachability data, incomplete asset inventory, or ambiguous finding descriptions. This creates false certainty that downstream teams treat as authoritative. Guardrail: Require a confidence score per finding with explicit uncertainty reasons. Add a rule that findings with missing critical inputs must be flagged as 'Needs Triage' rather than receiving a definitive rank. Route low-confidence rankings to human review.
Output Drift Under Backlog Scale
What to watch: When the input contains dozens or hundreds of findings, the model's ranking consistency degrades—later findings get less rigorous analysis, rationale becomes shorter, and ranking errors cluster toward the end of the output. Guardrail: Chunk large backlogs into batches of 20-30 findings with overlapping context. Run a consistency check across batches by re-ranking a few findings from earlier batches in later batches and comparing results. Log drift for eval review.
Evaluation Rubric
Use this rubric to evaluate the quality of the Risk Ranking Prompt for SAST Findings before shipping. Each criterion targets a specific failure mode in production triage workflows.
| Criterion | Pass Standard | Failure Signal | Test Method |
|---|---|---|---|
Ranking Rationale | Every ranking change from the raw severity score includes a specific, evidence-backed reason referencing exploitability, reachability, or asset criticality. | Output contains re-ranked items with no rationale, or rationale is generic ('high risk') without citing a specific factor. | Spot-check 10 re-ranked findings. Assert each has a non-empty rationale field that references at least one of [EXPLOITABILITY_ASSESSMENT], [REACHABILITY], or [ASSET_CRITICALITY]. |
Confidence Indicator | Every finding includes a confidence score (HIGH/MEDIUM/LOW) that accurately reflects the certainty of the re-ranking based on available context. | Confidence is always HIGH, or confidence is LOW for a finding where [CONTEXT] provides clear exploitability evidence. | Parse output for confidence field. Validate it is one of the allowed enum values. Check 5 LOW-confidence items against [CONTEXT] to ensure evidence was genuinely ambiguous. |
Existing Mitigation Handling | Findings with effective existing mitigations (WAF, sanitizer, auth gate) are correctly deprioritized with the mitigation explicitly cited. | A finding with a documented mitigation in [CONTEXT] is ranked as Critical without explaining why the mitigation is insufficient. | Inject a test case with a known WAF mitigation in [CONTEXT]. Assert the output rank is lower than the raw severity and the mitigation is cited in the rationale. |
Asset Criticality Weighting | Findings in non-critical assets are deprioritized, and findings in critical assets are prioritized, relative to their raw severity. | A Critical-severity finding in a low-sensitivity public blog service is ranked above a High-severity finding in a payments database. | Create a pair of test findings with inverted severity and asset criticality. Assert the output ranking order matches the criticality-weighted expectation. |
Output Schema Compliance | The output is valid JSON matching the [OUTPUT_SCHEMA] with all required fields present and correctly typed. | Output is missing the 'ranked_findings' array, or 'original_severity' is a string instead of an object. | Validate output against the [OUTPUT_SCHEMA] using a JSON schema validator. Assert no required fields are missing and types are correct. |
Hallucination Check | No finding IDs, file paths, or vulnerability details are invented that do not exist in the [INPUT] SAST findings list. | Output references a finding ID or CVE not present in the [INPUT] data. | Extract all finding IDs from the output. Assert each ID exists in the [INPUT] findings list. Flag any added external references for review. |
Uncertainty Flagging | Findings where the model cannot determine rank due to insufficient context are flagged for human review instead of being assigned a definitive rank. | An ambiguous finding with no reachability data is confidently ranked as Low without noting the uncertainty. | Provide a finding with deliberately missing reachability context. Assert the output includes a review flag or a LOW confidence score with an explicit note about missing data. |
Deduplication Awareness | The prompt does not re-rank findings that were previously identified as duplicates in [INPUT] if a deduplication step occurred upstream. | A duplicate finding is given a different rank than its canonical instance without explanation. | Provide an [INPUT] with a canonical finding and one marked as a duplicate. Assert the duplicate is either excluded from ranking or assigned the same rank as the canonical with a note. |
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Adapt This Prompt
How to adapt
Start with the base risk ranking prompt using a small batch of findings (5–10). Remove strict output schema requirements initially. Use a frontier model with high reasoning capability. Focus on getting ranking rationale quality right before adding validation layers.
codeRank these [N] SAST findings by actual risk. Consider exploitability, reachability, and asset criticality. Return a ranked list with brief rationale for each position. Findings: [FINDINGS_JSON]
Watch for
- Rankings that mirror raw severity scores without contextual reasoning
- Missing exploitability analysis when findings lack runtime context
- Overconfidence on findings with incomplete reachability data
- Model defaulting to alphabetical or severity-sort instead of risk-weighted ordering

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.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us