api-gateway-backend-security-and-rate-limiting

Configure authentication, backend security, and per-project rate limits for Google Cloud API Gateway.

23.7k|2.0k|Updated Mar 31, 2026
Ready to run
npx skills add https://github.com/google/skills --skill api-gateway-backend-security-and-rate-limiting-google
💬 Prompt for ChatGPT / Claude Chat▼
Please help me install this Agent Skill.
Skill: api-gateway-backend-security-and-rate-limiting
Source: https://github.com/google/skills/tree/main/skills/cloud/api-gateway-backend-security-and-rate-limiting
Command: npx skills add https://github.com/google/skills --skill api-gateway-backend-security-and-rate-limiting-google

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires PyYAML, and includes scripts (resource) and references (resource) components.

What problem does it solve? This Skill eliminates the complexity of securing API Gateway backends and enforcing quotas across multiple authentication schemes and OpenAPI versions. It prevents unauthorized backend access, verifies client identity, and implements rate limiting without downtime. ## Core Features & Use Cases - Client Authentication: Configure API keys and JWT tokens to identify calling projects and users. - Backend Security: Create dedicated gateway service accounts and lock down Cloud Run or Cloud Functions backends with OIDC tokens. - Rate Limiting: Define per-project quota metrics and enforce request limits using Service Control. - Zero-Downtime Rollout: Validate quota metrics before deployment to prevent HTTP 500 errors on live gateways. - MCP Support: Secure Model Context Protocol tool discovery and invocation with authentication. - Use Case: You have multiple consumer teams calling your order API. Configure an API key to track per-project quotas, set up JWT authentication for user claims, create a gateway service account to invoke Cloud Run securely, and validate quotas before updating the gateway so existing traffic never breaks. ## Quick Start Run the quota validation script against your OpenAPI spec and active gateways to ensure deploying a new API config won't cause HTTP 500 quota errors on existing gateways.

Frequently Asked Questions about api-gateway-backend-security-and-rate-limiting

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I configure JWT authentication on API Gateway?▼

Define a JWT security scheme in OpenAPI with x-google-issuer, x-google-jwks_uri (2.0) or x-google-auth (3.x) referencing your identity provider's public key set URI. Set audiences to match your managed service name. API Gateway verifies signatures and expiration, then passes verified claims via X-Apigateway-Api-Userinfo header.

What is the zero-downtime lockdown sequence for backend security?▼

First, create a gateway service account and grant roles/run.invoker on the backend. Second, create API config with --backend-auth-service-account. Third, update the gateway to the new config. Finally, restrict the backend with --no-allow-unauthenticated after the gateway is active. Skipping this order breaks live traffic with 403 errors.

Why do quota metric removals cause HTTP 500 on old gateways?▼

API config creation immediately replaces quota metrics for the entire API, not just one gateway. If an active gateway serves an older config referencing a removed metric, Service Control rejects quota calls with HTTP 500. Run check_quota_metrics.py before deployment to detect this.

How do I secure MCP tools/list discovery?▼

Configure x-google-api-management.mcp.tools-list.security with exactly one JWT or API key scheme. List the same JWT scheme in root security. API keys on tools/list must use x-api-key header, not query parameters. This prevents unauthenticated tool enumeration.

What header should backends read for end-user claims?▼

Read X-Apigateway-Api-Userinfo (base64url-encoded JSON) for client JWT claims, not Authorization. Authorization contains the gateway's service account token used to invoke Cloud Run. Decode X-Apigateway-Api-Userinfo to access iss, sub, aud, and custom claims.

Can I migrate quota metrics from OpenAPI 2.0 to 3.x without downtime?▼

Yes, using Path A: Run check_quota_metrics.py against active gateways, then keep both old and new metrics in the 3.x config until all gateways update. Path B requires uniform immediate upgrade of all gateways to the 3.x config. Path A is safer for multi-gateway production setups.