Skip to contentLockpick
How it worksPricingDocs

Read

  • BlogPlain answers to common security questions
  • GuidesStep by step fixes for common setups
  • Security checksEvery check we run, explained

Learn

  • Learn with PickTwo-minute lessons on how sites get attacked
  • Lockpick for ClaudeCheck sites from Claude and other assistants
  • GlossaryThe words we use, in plain words

Company

  • ChangelogWhat changed, newest first
  • StatusWhether scans are running right now
  • Security and trustHow we check and what we never do
Sign inCheck it
Blog

An API route answers without signing in, what it means and how to fix it

By Mark KashefPublished October 8, 2026

If an API route returns private data without a valid sign-in, anyone who finds it can read that data. Add the check in the route itself, not in the page that calls it. Being reachable isn't a problem by itself. The trouble starts when something reachable also answers without asking who you are.

Why the page is not enough

Your page may only call the route after someone signs in, but the route is a public address. Anyone can send it a request without your page. Next.js says to treat Route Handlers with the same security considerations as public-facing API endpoints, and to verify the user is allowed to access each one. Replit's security checklist says to always verify permissions before performing actions.

Curious what your site shows from outside? The quick check is free and needs no account.

Check it

How to fix it

  1. List every API route and decide who may call it.
  2. In each private route, read the session on the server and refuse the request when it is missing.
  3. Check the record belongs to the caller, not only that someone is signed in.
  4. Return only the fields the page needs.
// app/api/orders/route.ts on atlas.example
import { getSession } from '@/lib/session'
import { ordersFor } from '@/lib/orders'

export async function GET() {
  const session = await getSession()
  if (!session) return Response.json({ error: 'Sign in first' }, { status: 401 })
  return Response.json(await ordersFor(session.userId))
}

getSession and ordersFor stand for your own session and data code.

What the route returns without signing inWhat to do
Private recordsAdd the session check now
Public data, on purposeNothing, but make sure it is only public data
An errorGood, as long as it says nothing about the data

How to check

A scan tells you what answered, with the request it sent, so your developer can repeat it. Atlas, our example app at atlas.example, would show which route answered. Deep scans read your API when you have proved you own the site, and a Pulse or Deep page explains the difference. An outside check sees what answered, not your code, so it cannot prove that a route it did not find is protected.

Questions people ask

Is a route safe if nothing in my app links to it?

No. Routes can be found from your scripts and by guessing common names. The route has to check who is asking.

Is a check in Next.js middleware enough?

Use it for quick redirects, but check the session in the route itself as well, where the data is read.

See what your site shows from outside

A quick check reads your homepage the way a visitor would and gives you a score. No account needed.

Check your site

Related pages

  • Replit app security checklist for a live app
  • Supabase security checklist for apps built with AI
  • How Lockpick checks a site, and what we never do

Sources

  1. How to implement authentication in Next.js Next.js docs, read on October 6, 2026
  2. Security checklist Replit docs, read on October 6, 2026
  3. Your admin page is on the internet Lockpick docs, read on October 6, 2026

About the author

Mark Kashef, Founder of Lockpick

I'm Mark, and I build Lockpick. I write these pages, and each one is checked against its sources before it goes live. The Updated date changes only when the page itself does.

Lockpick
PricingMethodologyDocsBlogGuidesSecurity checksLearn with PickSecurity and trustLockpick for ClaudeChangelogStatusFacts for AI assistants

Lockpick is a security scanner for vibe-coded apps. It checks what your live site exposes and what a GitHub repo or AI skill would do before you install it, then gives you a fix prompt for Lovable, Bolt, Replit, Cursor or Claude Code.

Lockpick assesses public pages you are authorized to test, and public GitHub code it never runs.

© 2026 LockpickTermsPrivacyContactSign in