Inferensys

Prompt

API Gateway Security Architecture Review Prompt

A practical prompt playbook for reviewing API gateway security architecture in production AI workflows. Covers authentication, authorization, rate limiting, request validation, and threat protection with OWASP API top-10 alignment.
Wide-angle shot of a modern WeWork open floor plan with creative walls covered in AI system architecture diagrams, product team collaborating in standing desk area with industrial lighting.
PROMPT PLAYBOOK

When to Use This Prompt

Defines the ideal user, required inputs, and operational boundaries for the API Gateway Security Architecture Review Prompt.

This prompt is designed for security architects and platform engineers who need to perform a structured security assessment of an API gateway design before it is implemented or during a formal architecture audit. The job-to-be-done is converting a static design document, configuration spec, or architecture proposal into a dynamic control assessment that identifies specific gaps in authentication enforcement, authorization policy, rate limiting, request validation, and threat protection. The ideal user has access to a detailed gateway architecture document that describes routing rules, policy configurations, and backend service relationships, and they need an output that maps findings directly to the OWASP API Security Top-10 risks with severity ratings and actionable remediation guidance.

To use this prompt effectively, you must provide a design document that contains enough technical detail for the model to reason about control placement and effectiveness. The input should describe how the gateway handles token validation, scope checks, rate limit keys, request schema validation, and threat detection rules. The prompt assumes the gateway sits at the boundary between clients and backend services, and it will probe for common architectural weaknesses such as direct backend access paths that bypass the gateway, inconsistent authorization across routes, and missing controls on internal service-to-service calls. Do not use this prompt for runtime incident response, where you need live traffic analysis and real-time attack correlation, because it lacks the context of production telemetry. Do not use it for code-level vulnerability scanning, which requires static analysis of implementation details rather than architectural control placement. Do not use it for penetration test reports, which demand evidence of exploitability and proof-of-concept validation that a design review cannot provide.

Before running this prompt, verify that your input document covers the gateway's role in the broader system architecture, including how it integrates with identity providers, service meshes, and monitoring systems. The prompt is most effective when the design is stable enough to review but not yet locked into implementation, giving you time to address findings before they become expensive to fix. After receiving the assessment, treat high-severity findings as candidates for immediate architectural revision, and use the OWASP mapping to prioritize remediation based on your organization's risk appetite. If the input document is incomplete or the gateway design is still in early exploration, consider using a lighter-weight threat modeling prompt first, then return to this assessment when the design has enough detail to support a control-by-control review.

PRACTICAL GUARDRAILS

Use Case Fit

Where this prompt delivers reliable results and where it falls short.

01

Good Fit: Structured Design Docs

Use when: You have a written API gateway design document, architecture diagram, or configuration spec. The prompt excels at extracting controls from structured technical prose and mapping them to OWASP API top-10 risks. Guardrail: Provide the full document; the prompt needs complete context to identify missing controls.

02

Bad Fit: Runtime Traffic Analysis

Avoid when: You need to analyze live API traffic, WAF logs, or dynamic request patterns. This prompt reviews static designs, not runtime behavior. Guardrail: Pair with a log analysis or dynamic testing tool for runtime threats; use this prompt only for design-time review.

03

Required Inputs

What you must provide: API gateway architecture description, authentication/authorization flow details, rate limiting configuration, request validation rules, and backend service topology. Guardrail: Missing any of these inputs produces incomplete assessments; the prompt cannot invent gateway controls that aren't described.

04

Operational Risk: Bypass Paths

What to watch: The prompt may miss direct-to-backend access paths that circumvent the gateway entirely. Design docs often omit internal routing exceptions. Guardrail: Always supplement with a network topology review and explicitly ask about backend-to-backend communication paths in your input document.

05

Operational Risk: Configuration Drift

What to watch: The prompt reviews the design as documented, not the deployed configuration. Gateway configs drift over time as rules are added, modified, or bypassed for debugging. Guardrail: Re-run the review after any gateway configuration change and compare outputs to detect drift.

06

Human Review Required

What to watch: The prompt may flag theoretical risks that have accepted business justifications or miss context-specific threats unique to your threat model. Guardrail: Treat the output as a review aid, not a final security sign-off. A security architect must validate findings and prioritize remediation.

PROMPT PLAYBOOK

Copy-Ready Prompt Template

A copy-ready prompt that performs a structured security review of an API gateway architecture against OWASP API top-10 risks and common bypass patterns.

This prompt template is designed to be pasted directly into your AI workflow. It instructs the model to act as a security architect reviewing an API gateway design for authentication, authorization, rate limiting, request validation, and threat protection controls. The prompt is structured for single-pass execution and returns a machine-readable JSON output that can be validated by downstream application code.

text
You are a principal security architect specializing in API gateway security. Review the provided API gateway architecture description against the OWASP API Security Top 10 and common gateway bypass patterns. Your review must be evidence-based, referencing specific details from the input. Do not invent controls that are not described.

## INPUT
[ARCHITECTURE_DESCRIPTION]

## CONSTRAINTS
- Only assess controls explicitly mentioned or clearly implied by the architecture description.
- Flag missing controls as gaps; do not assume they exist.
- If the description is insufficient to assess a risk, mark it as "INSUFFICIENT_DATA" with a brief explanation of what information is needed.
- For each finding, cite the specific part of the architecture description that supports your assessment.

## OUTPUT_SCHEMA
Return a single JSON object with the following structure:
{
  "assessment_summary": {
    "overall_risk_level": "LOW" | "MEDIUM" | "HIGH" | "CRITICAL",
    "total_findings": <number>,
    "critical_findings": <number>,
    "high_findings": <number>,
    "medium_findings": <number>,
    "low_findings": <number>
  },
  "findings": [
    {
      "id": "F-<sequential number starting at 001>",
      "owasp_category": "<OWASP API category, e.g., API1:2023 Broken Object Level Authorization>",
      "severity": "CRITICAL" | "HIGH" | "MEDIUM" | "LOW" | "INFO",
      "title": "<concise finding title>",
      "description": "<detailed description of the finding>",
      "evidence": "<direct quote or reference from the architecture description>",
      "impact": "<what an attacker could achieve if this is exploited>",
      "recommendation": "<specific, actionable remediation step>",
      "bypass_risk": "<description of how this control could be bypassed, or 'NONE' if not applicable>"
    }
  ],
  "bypass_analysis": {
    "direct_backend_access": "<assessment of whether backend services can be reached without traversing the gateway>",
    "header_injection_risk": "<assessment of header forwarding and trust boundaries>",
    "authentication_bypass_paths": "<identified paths that might skip authentication>",
    "rate_limit_evasion": "<assessment of rate limiting bypass techniques like IP rotation or header manipulation>"
  },
  "insufficient_data_items": [
    {
      "topic": "<what is missing>",
      "why_needed": "<why this information matters for the assessment>"
    }
  ]
}

## RISK_LEVEL
[RISK_LEVEL]

## EXAMPLES
[EXAMPLES]

Adapting the template: Replace [ARCHITECTURE_DESCRIPTION] with the full text of your API gateway design document, architecture diagram description, or configuration summary. The [RISK_LEVEL] placeholder accepts a value like HIGH to calibrate the review's sensitivity—use HIGH for payment systems or PII-handling APIs, and MEDIUM for internal tools. The [EXAMPLES] placeholder can be populated with one or two example findings from prior reviews to calibrate output style and severity judgment. After pasting, verify that the model returns valid JSON matching the output schema before wiring this into an automated pipeline.

Validation and safety: Because this prompt produces security findings that may influence architectural decisions, always run the output through a JSON schema validator before ingestion. For high-risk systems, route findings marked CRITICAL or HIGH to a human security reviewer before accepting them as actionable. The bypass_analysis section is particularly important—many gateway reviews focus on the happy path and miss direct backend access or header injection paths. If the model returns INSUFFICIENT_DATA items, treat those as blockers: do not proceed with the review until the missing information is provided. A common failure mode is the model inventing controls that are not described; the evidence field requirement and the constraint against assuming controls are designed to catch this.

IMPLEMENTATION TABLE

Prompt Variables

Each placeholder must be replaced with specific, accurate information for reliable results.

PlaceholderPurposeExampleValidation Notes

[ARCHITECTURE_DOCUMENT]

The full text of the API gateway design document, architecture diagram description, or configuration spec to review

API Gateway Design v2.3: Kong Gateway on AWS with Lambda authorizers, Redis rate limiting, and WAF integration

Must be non-empty text. If null or whitespace, abort and request input. Minimum 200 characters to ensure sufficient design detail for review.

[GATEWAY_PRODUCT]

The specific API gateway product or service being used in the architecture

Kong Gateway 3.7

Must match a known gateway product name. Use for product-specific control mapping. If custom or unknown, set to 'Custom Gateway' and note that product-specific checks will be skipped.

[AUTH_MECHANISMS]

List of authentication and authorization mechanisms described in the architecture

OAuth 2.0 with PKCE, JWT validation via Lambda authorizer, API key for partner endpoints

Must be a comma-separated list. Each mechanism is checked against OWASP API top-10 controls. If empty, flag as critical gap in review output.

[UPSTREAM_SERVICES]

List of backend services, endpoints, or microservices behind the gateway

user-service:443, order-service:443, inventory-service:443, legacy-soap-adapter:8080

Must include host:port or service:port pairs. Used to detect direct-backend access paths. If empty, bypass-path analysis cannot run.

[TRUST_BOUNDARIES]

Description of where trust boundaries exist in the architecture, including network zones and service-to-service assumptions

Public internet to DMZ, DMZ to internal VPC, internal VPC to database subnet. Service-to-service within VPC uses mTLS.

Must describe at least one boundary. Used to validate that every boundary enforces auth. If missing, zero-trust assessment will flag all paths as unverified.

[COMPLIANCE_STANDARDS]

Applicable regulatory or compliance frameworks the architecture must satisfy

PCI DSS 4.0, SOC 2 Type II

Optional. If provided, control mapping includes standard-specific requirements. If null, review defaults to OWASP API top-10 and general best practices only.

[KNOWN_EXCLUSIONS]

Any known gaps, accepted risks, or out-of-scope components the reviewer should acknowledge

Rate limiting for internal admin API is deferred to Q3. Legacy SOAP adapter does not support mTLS.

Optional. If provided, these items are noted as acknowledged gaps rather than findings. If null, all gaps are reported as unreviewed risks.

[OUTPUT_FORMAT]

Desired structure for the review output

JSON with findings array, severity levels, control mappings, and remediation steps

Must be one of: JSON, Markdown, or SARIF. Defaults to JSON if unspecified. Schema validation applied post-generation.

PROMPT PLAYBOOK

Implementation Harness Notes

How to wire the API Gateway Security Architecture Review Prompt into an application, validation pipeline, or review workflow.

This prompt is designed to be integrated into a security review pipeline, not used as a one-off chat. The primary integration point is a CI/CD or design-review platform where architecture documents (ADRs, interface specs, network diagrams) are submitted for automated assessment. The prompt expects a structured [ARCHITECTURE_DOCUMENT] input, typically a markdown or JSON representation of the gateway configuration, routing rules, and authentication policies. The output is a structured JSON assessment that downstream systems can parse, store, and compare against previous reviews.

Wire the prompt into an application by first validating the input document for completeness before calling the model. Implement a pre-flight check that verifies the presence of required sections: authentication mechanisms, authorization policies, rate limiting configuration, request validation rules, and backend service mappings. If any section is missing, return a structured error to the user rather than sending an incomplete document to the model. After the model responds, validate the output JSON against a strict schema that includes required fields like findings, severity, owasp_category, affected_endpoints, and remediation. Use a JSON Schema validator in your application code—do not rely on the model to always produce valid JSON. On validation failure, implement a single retry with the error message appended to the prompt context, then escalate to human review if the retry also fails.

For high-risk deployments, route all CRITICAL or HIGH severity findings to a human approval queue before the review is considered complete. Log every prompt invocation with the input document hash, model version, output findings, and reviewer decision. This creates an audit trail for compliance and allows you to track whether the model's assessments are becoming more or less conservative over time. Use a model with strong structured output support (GPT-4o with response_format or Claude with tool use) and set temperature=0 to minimize variance across repeated reviews. If your gateway configuration includes sensitive endpoints or internal IP addresses, redact them in a pre-processing step before sending to the model API. Finally, implement a bypass-detection eval: after the model produces its assessment, run a separate check that verifies every public endpoint is accounted for in the authentication and authorization findings—this catches the common failure mode where the model misses direct backend access paths that bypass the gateway entirely.

IMPLEMENTATION TABLE

Expected Output Contract

Defines the JSON structure, field-level validation rules, and data types the model must satisfy when producing an API Gateway Security Architecture Review. Use this contract to validate outputs before they enter downstream systems or dashboards.

Field or ElementType or FormatRequiredValidation Rule

review_id

string (UUID v4)

Must match regex ^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$. Auto-generated if missing.

target_gateway

string

Must be a non-empty string matching the gateway product name provided in [GATEWAY_PRODUCT]. Case-insensitive match accepted.

assessment_date

string (ISO 8601)

Must be a valid ISO 8601 date string (YYYY-MM-DD). Must not be a future date. Default to current date if [ASSESSMENT_DATE] is null.

owasp_api_2023_coverage

array of objects

Array must contain exactly 10 elements, one per OWASP API Security Top 10 (2023) category. Each object must have 'category_id' (string, e.g., 'API1:2023'), 'risk_level' (enum: Critical, High, Medium, Low), and 'finding_summary' (string, max 500 chars). No duplicate category_id allowed.

authentication_controls

array of objects

Each object must contain 'mechanism' (string, e.g., 'OAuth2', 'mTLS'), 'configuration_issues' (array of strings), and 'bypass_risk' (enum: High, Medium, Low). Array must not be empty. If [AUTH_CONFIG] is provided, cross-reference mechanism names.

rate_limiting_assessment

object

Must contain 'strategy' (string), 'per_endpoint_limits' (array of objects with 'endpoint' and 'limit' fields), and 'ddos_mitigation_gaps' (array of strings). 'strategy' must not be empty. If [RATE_LIMIT_CONFIG] is null, set 'per_endpoint_limits' to empty array.

request_validation_findings

array of strings

Must contain at least one finding. Each string must describe a specific validation gap (e.g., 'Missing JSON schema validation on /users endpoint'). If no gaps found, array must contain exactly one element: 'No request validation gaps identified.'

direct_backend_access_paths

array of objects

Each object must have 'path' (string), 'risk' (enum: Critical, High, Medium, Low), and 'mitigation' (string). If [ARCHITECTURE_DIAGRAM] is provided, paths must reference named services. Array can be empty only if 'No direct backend access paths identified' is the sole element.

PRACTICAL GUARDRAILS

Common Failure Modes

API gateway security reviews fail in predictable ways. These are the most common production failure modes and how to guard against them before the review goes live.

01

Bypass via Direct Backend Access

What to watch: The prompt assumes all traffic flows through the gateway, but the architecture diagram reveals internal services with public IPs, direct load balancer targets, or service mesh endpoints that bypass gateway controls entirely. Guardrail: Add a pre-review step that enumerates every backend's network exposure. The prompt must flag any backend reachable without gateway traversal as a critical finding.

02

Authentication Check Without Token Validation Depth

What to watch: The prompt identifies that authentication exists at the gateway but fails to drill into token validation specifics—signature verification, issuer validation, audience restriction, expiry enforcement, and revocation checks. A gateway that passes tokens without full validation is a pass-through, not a security control. Guardrail: Include explicit sub-checks in the prompt for each token validation property. Require the output to call out any missing validation step by name.

03

Rate Limiting Reviewed in Isolation

What to watch: The prompt evaluates rate limiting as present or absent without analyzing per-endpoint granularity, authenticated vs. unauthenticated limits, or upstream backpressure. A global rate limit that doesn't distinguish between a health check and a password reset endpoint creates both availability risk and brute-force openings. Guardrail: Require the prompt to assess rate limiting per OWASP API risk category, not as a binary control. Output must map limits to specific endpoint classes.

04

Request Validation Depth Skipped for Nested Payloads

What to watch: The prompt checks that the gateway validates content-type, size, and basic schema but misses deeply nested JSON, multipart uploads, or GraphQL query depth. Attackers exploit these gaps with resource exhaustion or injection through nested structures the gateway passes blindly. Guardrail: Add explicit prompt instructions to evaluate validation at every nesting level, including recursion limits, array size caps, and multipart boundary handling.

05

Threat Protection Scoped Only to OWASP API Top-10 Headlines

What to watch: The prompt produces a checklist that maps controls to OWASP categories at the title level without verifying whether the control actually mitigates the underlying attack vectors. A WAF rule that blocks SQLi in query params doesn't help if the gateway passes GraphQL mutations unparsed. Guardrail: Require the prompt to test each OWASP category against at least two concrete attack vectors relevant to the system's actual API surface. Output must distinguish between nominal coverage and effective coverage.

06

Logging and Monitoring Treated as Out of Scope

What to watch: The prompt focuses entirely on preventive controls and omits detection. A gateway that blocks attacks but logs nothing leaves the security team blind to reconnaissance, credential stuffing attempts, and successful bypasses that didn't trigger blocks. Guardrail: Include mandatory prompt sections for audit logging completeness, SIEM integration readiness, and alert coverage for gateway-detected anomalies. The output must flag any gateway design that lacks structured security telemetry.

IMPLEMENTATION TABLE

Evaluation Rubric

Score each assessment against these criteria before shipping the API Gateway Security Architecture Review Prompt. Run these checks on a sample of 5-10 gateway design documents to calibrate pass/fail thresholds.

CriterionPass StandardFailure SignalTest Method

OWASP API Top-10 Coverage

Output maps at least 8 of 10 OWASP API risks to specific gateway controls or gaps

Output mentions fewer than 5 risks or uses generic 'check OWASP' language without mapping to gateway config

Parse output for OWASP API-2023 risk labels; count unique risks with a gateway control or gap statement

Bypass Path Detection

Output identifies at least one direct-backend or internal-service access path that skips the gateway

Output states all traffic flows through gateway without checking internal service-to-service calls or VPN paths

Check for presence of 'direct access', 'bypass', 'internal path', or 'service-to-service' in findings section

Authentication Control Assessment

Output evaluates token validation, endpoint auth coverage, and anonymous access paths with specific misconfiguration risks

Output only says 'authentication is configured' without checking which endpoints are protected or how tokens are validated

Verify output contains at least one endpoint-level auth check and one token validation check

Rate Limiting and Abuse Prevention

Output assesses per-endpoint or per-consumer rate limits, burst handling, and abuse detection gaps

Output mentions rate limiting exists without checking thresholds, scope, or bypass via header manipulation

Search output for specific rate-limit values, consumer scoping, or bypass vectors like X-Forwarded-For spoofing

Request Validation Depth

Output checks input validation at gateway for schema, size, content-type, and injection patterns

Output assumes backend handles all validation or only checks for SQL injection

Confirm output addresses at least three of: schema validation, size limits, content-type enforcement, parameter tampering, or nested object attacks

Error Handling and Information Leakage

Output flags stack traces, internal IPs, or backend details in gateway error responses

Output does not mention error response content or assumes default error pages are safe

Search output for 'error response', 'stack trace', 'information disclosure', or 'verbose errors'

Logging and Audit Trail Completeness

Output assesses whether gateway logs capture auth decisions, rate-limit events, and request metadata for forensics

Output omits logging entirely or only mentions access logs without auth or rate-limit event logging

Check output for 'audit log', 'forensics', 'auth decision log', or 'rate-limit event log'

Citation and Evidence Grounding

Every finding references a specific gateway configuration element, policy name, or design document section

Findings use vague language like 'the gateway should' without pointing to where the gap exists in the provided design

Count findings without a configuration reference, policy name, or document section citation; fail if more than 20% are ungrounded

ADAPTATION OPTIONS

Adapt This Prompt

How to adapt

Use the base prompt with a single gateway config document and lighter validation. Drop the OWASP API top-10 mapping requirement and focus on the top 5 findings. Accept plain-text output instead of strict JSON.

Watch for

  • Missing schema checks on the output
  • Overly broad instructions that produce vague findings
  • No verification that the model actually read the full config
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.