Cron and webhook-style job endpoints anyone can trigger
Last updated November 11, 2026
Steps
- List every scheduled job: vercel.json "crons" entries, Supabase pg_cron or scheduled Edge Functions, GitHub Actions schedules, and any external pinger calling your app.
- On Vercel, add a CRON_SECRET environment variable (Vercel recommends a random string of at least 16 characters). Vercel then sends it as an Authorization: Bearer header when it calls your cron job.
- At the top of each job route, compare the Authorization header to Bearer + CRON_SECRET and return 401 if it doesn't match, before any work happens.
- For Supabase scheduled functions, keep the key or token in Supabase Vault as its docs show, not hard-coded in the SQL, and check it in the function.
- Make each job safe to run twice or to skip a run. Vercel's docs say cron delivery is best effort: a scheduled run can occasionally be missed or invoked more than once, and a long job can overlap with the next one. Use a lock or a "last processed" marker.
- Rename any job URL that has already been shared or logged, and rotate the secret if it ever appeared in client code or a public repo.
Why it matters
A cron route is just an HTTP endpoint. Vercel's cron documentation says to secure it with CRON_SECRET and check the Authorization header in your function. Without that check, the job is as public as your homepage.
Sources
Vercel Docs: Managing Cron Jobs (Securing cron jobs, idempotency, concurrency) — https://vercel.com/docs/cron-jobs/manage-cron-jobs
Supabase Docs: Scheduling Edge Functions — https://supabase.com/docs/guides/functions/schedule-functions
Related patterns
Found a problem you'd rather not fix yourself?
Tell us what's wrong. A StorenTech engineer reviews your app and replies with a fixed quote, so you know the cost before any work starts.
Get it fixed by StorenTechVibe Security Weekly
One email a week with new failure patterns and how to fix them.
By joining you agree we may email you this newsletter. See our privacy policy. Free. Unsubscribe anytime. We'll never sell your email.