日本語

Lock down your AI API keys: free checklist (PDF)

Railway’s incident report of 10 November 2026 estimates unauthorized spend on stolen keys at about $740,000 (BleepingComputer reported the same day). Keys can be stolen from a platform even when you did nothing wrong. Nine steps to keep the damage small. (Source: Railway, 2026-11-10) (Source: BleepingComputer, 2026-11-10)

  1. Revoke and re-issue any exposed key now
    Create a new key at the provider, switch the app to it, then revoke the old one. Deleting a key from a page or a repo does not stop it from working.
  2. Set spend caps and usage alerts at every AI provider
    In each provider’s console, set a monthly budget or limit and an email alert above a set amount. If you pay by prepaid credit, turn off auto-recharge so the worst case has a ceiling.
  3. Keep keys out of client-side code
    Anything in front-end JavaScript or in public env variables (for example names starting with VITE_ or NEXT_PUBLIC_) is shipped to every visitor’s browser. Call AI APIs from the server side (a server or edge function) and keep keys in server-only env variables.
  4. Keep keys out of git
    Put .env files in .gitignore. A key that was ever committed stays in the history, so rotate it rather than just deleting it. In a public repo, rotate it first.
  5. Turn on secret scanning
    Use GitHub secret scanning and push protection, or a tool such as gitleaks, before commits and on a schedule. Review your host’s env variables and remove the ones nobody uses.
  6. Use scoped, least-privilege keys
    Use separate keys per environment and per app, limited to the projects and permissions they need. Restrict keys that support it by referrer or IP (for example Google API keys). One key per job keeps a leak small and quick to fix.
  7. Watch usage
    Check usage and billing on a fixed schedule, such as weekly, so a spike stands out. If you see usage you do not recognise, revoke the key and contact the provider.
  8. Plan for a breach at a provider that holds your keys
    List every place your keys are stored (hosting, CI, no-code tools) and keep a runbook to rotate all of them quickly. As the Railway incident shows, keys can be stolen from a platform even when you did nothing wrong.
  9. Keep the Supabase service_role key on the server
    The service_role key bypasses your database rules. Only the anon key belongs in the browser, and then Row Level Security must be on for every table.

Download the PDF

Register your email to download the printable PDF.

This uses PHPcheck.jp’s existing notice signup. Only your email is stored, and only those notices are sent. To unsubscribe, email contact@phpcheck.jp. Privacy policy

Check your app with the free checker, or read the background.

Sources

Every figure was checked in the sources above on 2026-11-12. At most one short quote per source; everything else is PHPcheck.jp's own summary.

Check what you own

Is my AI-built app public? (free)

AI API key checklist (free PDF) · Supabase access-rule check · Free CVE alerts (Japanese) · Free PHP check and ¥1,480 pack (Japanese)