Security · Astro
I found an API key in my page source in Astro
The fix for Astro
13x detects your framework from the response and hands you this version rather than the generic one — below 50% confidence it hedges and gives you the generic one instead.
Rotate the key first — revoke and reissue it before changing code.
Astro exposes anything prefixed PUBLIC_ to the client and keeps everything
else server-side.
# .env
STRIPE_SECRET_KEY=sk_live_REPLACE_WITH_YOUR_KEY # server only
PUBLIC_STRIPE_KEY=pk_live_REPLACE_WITH_YOUR_KEY # shipped to the browser// src/pages/api/checkout.ts
export const prerender = false;
export async function POST({ request }) {
const secret = import.meta.env.STRIPE_SECRET_KEY;
// …
}A secret referenced from a .astro component's client-side <script> is
inlined into the page. Keep secret access inside the frontmatter or an endpoint.
On a different stack? The general version of this fix explains what 13x checks and why it matters, without assuming a framework.
Check your Astro site
113 deterministic checks against your live URL, in about 30 seconds. Framework detected from the response, so every fix comes back in the form your stack actually uses.
No signup. Results in 30 seconds.