Command Palette

Search for a command to run...

Назад к скиллам
скилл № 83323

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

Secures and rate limits backend services behind Google Cloud API Gateway across OpenAPI 2.0 and OpenAPI 3.x API configurations, including MCP-enabled…

БесплатноЗапускает вложенные скрипты
googleот google★ 25 380 звёзд на GitHub

Установить api-gateway-backend-security-and-rate-limiting в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Об этом скилле

API Gateway Backend Security and Rate Limiting

This skill configures client authentication, gateway-to-backend authentication, and per-project rate limits (quotas) for Google Cloud API Gateway across OpenAPI 2.0 (swagger: "2.0") and OpenAPI 3.x (3.0.x and 3.1.x, such as openapi: 3.0.4), including gateways with Model Context Protocol (MCP) enabled (Public Preview).

Usage Attribution

MUST READ: Before executing any gcloud, REST API, or MCP command, you MUST read and follow the instructions in Usage Attribution.

Prerequisites

  1. Install the Google Cloud CLI and Python 3.10+ YAML parser:
    • If gcloud is not installed, give the user the Google Cloud CLI install guide. Do not install it yourself. Until it is installed, give the user the commands to run, and continue from the output that they paste.
    • If the gcloud CLI is old, ask the user before you run gcloud components update. An old gcloud CLI can fail when it uploads an OpenAPI 3.x spec.
    • Install PyYAML for the quota metric validation script. Ask the user before you install it:
      pip install "PyYAML>=6.0,<7.0"
      
  2. Authenticate your environment:
    • Local CLI session: gcloud auth login
    • Application Default Credentials (SDKs): gcloud auth application-default login
    • Service account key file (if required by CI): set GOOGLE_APPLICATION_CREDENTIALS={key_file_path}
  3. Select or create a project, verify billing, and pick a supported gateway location:
    • Ask the user which project to use, and use that ID as {project_id}. Pass --project={project_id} on every command. Do not run gcloud config set project, because it changes the default project for all other work of the user. If no project exists, create one with gcloud projects create {project_id} as an escape hatch.
    • Verify that an active billing account is linked to {project_id} (required even when staying within the API Gateway pricing free tier).
    • Use us-central1 as the default --location for API Gateway commands. For the other supported regions, see API Gateway deployment model.
  4. Enable required Google Cloud APIs:
    gcloud services enable \
      apigateway.googleapis.com \
      servicemanagement.googleapis.com \
      servicecontrol.googleapis.com \
      iam.googleapis.com \
      apikeys.googleapis.com \
      --project={project_id}
    
    API Gateway does not need the Cloud Run API. If the backend runs on Cloud Run, that API is already enabled in the backend's project.
  5. Verify required IAM roles:
    • To manage API Gateway resources and enable services: roles/apigateway.admin and roles/serviceusage.serviceUsageAdmin
    • To create the gateway service account and attach it to an API config: roles/iam.serviceAccountAdmin and roles/iam.serviceAccountUser
    • To manage API keys in consumer projects: roles/serviceusage.apiKeysAdmin
    • To change the IAM policy of the Cloud Run backend (grant the invoker role, remove allUsers, and turn on the invoker IAM check): roles/run.admin, or another role with run.services.get, run.services.getIamPolicy, run.services.setIamPolicy, and run.services.update. For a 1st gen function backend: roles/cloudfunctions.admin
    • For the gateway service account to invoke the backend: roles/run.invoker (Cloud Run or 2nd gen functions) or roles/cloudfunctions.invoker (1st gen functions)

Decision Matrix: Client Authentication, Backend Security, and Quotas

Select the layer that matches the security requirement:

Goal Mechanism to Configure Key Constraint Detailed Reference
Identify the calling consumer project for quotas and billing API key in the x-api-key header (use the key or api_key query parameter only as an escape hatch) NEVER rely on an API key alone to authenticate end-user identity. Rationale: API keys identify a Google Cloud project rather than a user, and clients can extract them. API Gateway ignores an API key scheme with any other name or location, with no error, and the operation then accepts calls with no key. Client Authentication
Authenticate end users or calling services JWT (oauth2 scheme with x-google-issuer / x-google-jwks_uri in OAS 2.0, or x-google-auth in OAS 3.x) Operation-level security overrides root security. Include api_key: [] and the JWT scheme in the same security requirement object when an endpoint needs both user identity and quotas. Client Authentication
Block direct calls to the backend service Dedicated gateway service account (--backend-auth-service-account) + roles/run.invoker +
Полный SKILL.md на GitHub

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

  • references/attribution.md
  • references/backend-security.md
  • references/client-authentication.md
  • references/mcp-traffic-security.md
  • references/quotas-and-rate-limiting.md
  • scripts/check_quota_metrics.py

FAQ

Что делает скилл api-gateway-backend-security-and-rate-limiting?

Secures and rate limits backend services behind Google Cloud API Gateway across OpenAPI 2.0 and OpenAPI 3.x API configurations, including MCP-enabled gateways. Use when configuring API key or JWT authentication, locking down Cloud Run or Cloud Run functions backends with a gateway service account, reading authenticated claims from X-Apigateway-Api-Userinfo, setting per-project request quotas, or changing quota metrics without the HTTP 500 "Failed to call Service Control Quota" error on older gateways. Do not use for finding the cause of failing requests from gateway logs, such as an unexplained HTTP 429 or 5xx (use api-gateway-troubleshooting), writing or migrating a whole spec (use api-gateway-openapi-spec-authoring), MCP tool setup (use api-gateway-mcp-server), Apigee, GKE Gateway API, Cloud Load Balancing custom domain setup, or LLM model routing.

Как установить скилл api-gateway-backend-security-and-rate-limiting?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл api-gateway-backend-security-and-rate-limiting запускает скрипты?

Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.

Похожие скиллы

Сравнить api-gateway-backend-security-and-rate-limiting с