rotate-and-scope-api-keys
Use when provisioning credentials for an integration. Grant the narrowest scope, store the key in a secret manager, rotate on a schedule, and revoke the old key — broad non-expiring keys are the default failure.
- License 许可
- MIT
- 最近更新
- 2026-11-13
- Stars
- ★ 81
- Forks
- 17
01 前言 Front Matter
- name
- rotate-and-scope-api-keys
- description
- Use when provisioning credentials for an integration. Grant the narrowest scope, store the key in a secret manager, rotate on a schedule, and revoke the old key — broad non-expiring keys are the default failure.
02 资源文件 3
- 许可证LICENSE1.0 KB
- 参考文档SOURCE.md351 B
- 参考文档TRUST.auto.yaml2.2 KB
03 SKILL.md 正文
Rotate and scope API keys
A single admin key with no expiry, pasted into an environment file, is the credential that ends up in a public repo. Provision narrowly, store centrally, rotate, and revoke.
Procedure
- Read the provider's scope model and grant only what each job needs (read-only where possible).
- Create a distinct key per service and environment; never share one across prod and dev.
- Store in a secret manager (
aws secretsmanager get-secret-value, Vault, SOPS), not in committed.envor code. - Set an expiry/rotation cadence and automate rotation with an overlap window where both keys work.
- Revoke the old key after the new one is confirmed, then prove the old key now fails:
curl -s -o /dev/null -w '%{http_code}\n' -H "Authorization: Bearer $OLD" "$API/v1/me" # expect 401 - Log which key id made which call so a leaked key can be traced.
- Alert before expiry so rotation is not a surprise outage.
Pitfalls
- Keys pasted into source, CI logs, or chat leak on the first push; assume compromise and rotate.
- An admin-scoped key on a read-only job violates least privilege.
- Rotating with no overlap window breaks consumers at the switch instant.
- Some providers display a key only once at creation; losing it forces a recreate, so store immediately.
- Unused keys linger; audit and revoke anything with no calls in 90 days.
Verification
curl -s -o /dev/null -w '%{http_code}\n' -H "Authorization: Bearer $OLD" "$API/v1/me" # 401
curl -s -o /dev/null -w '%{http_code}\n' -H "Authorization: Bearer $NEW" "$API/v1/me" # 200
curl -s -H "Authorization: Bearer $NEW" "$API/v1/scopes" | jq . # narrow scope list
Report: "Rotated key id k-92; old revoked (401), new active (200), scopes items:read."
04 同仓库更多 Skills
recipe-performance
Diagnose a specific MetaMask user flow's real-app performance and Sentry critical-user-flow telemetry with deterministic mm-harness recipes. Use for CUF boundaries, cold/warm/background-resume behavior, latency regressions, lifecycle tags, duplicate or blocking network requests, long tasks, layout/paint cost, screen redraws, React rerenders, or browser trace analysis where tests alone cannot prove the real app.
mexc-spot-websocket
MEXC Spot WebSocket workflows for public streams, protobuf handling, depth maintenance, listen keys, and private streams without exposing API keys.
mexc-spot-rest
MEXC Spot REST workflows for public data, signed account requests, orders, wallet/admin actions, and secure signing without exposing API keys.
mexc-futures-websocket
MEXC Futures WebSocket workflows for public streams, private account/order/position streams, ping/pong, subscriptions, and depth maintenance.
0xklen-version-and-refresh-sanctions-lists
暂无简介
verify-tests-cover-changed-lines
Use when a PR adds code that the existing suite may not exercise. Measures patch coverage — the share of newly changed lines hit by tests — before approving.