Skip to main content
InfoAPIOWASP A01:2021CWE-284

How to fix: REST endpoint allows DELETE

REST endpoint exposes DELETE without authentication.

Why it matters

Unauthenticated DELETE endpoints allow any internet-reachable client to permanently destroy resources, enabling data-loss attacks or cascading failures in downstream systems that depend on those records.

REST endpoint exposes DELETE without authentication.

How to fix it

  1. 1Require authentication on all state-changing verbs (DELETE, PATCH, PUT, POST)
  2. 2Return 401 for missing tokens and 403 for insufficient scope
  3. 3Use middleware to enforce auth before any route handler runs

Code examples

Express.js: auth guard middleware

JavaScript
function requireAuth(req, res, next) {
  const token = req.headers.authorization?.split(' ')[1];
  if (!token) return res.status(401).json({ error: 'Unauthorized' });
  try {
    req.user = jwt.verify(token, process.env.JWT_SECRET);
    next();
  } catch {
    res.status(401).json({ error: 'Invalid token' });
  }
}

// Apply before DELETE route
router.delete('/resource/:id', requireAuth, deleteHandler);

Next.js Route Handler: auth check

TypeScript
import { getSession } from '@/lib/auth';
import { NextResponse } from 'next/server';

export async function DELETE(req: Request) {
  const session = await getSession();
  if (!session) {
    return NextResponse.json({ error: 'Unauthorized' }, { status: 401 });
  }
  // ... delete logic
}

References

Detected automatically by VulnRadar. The check id is api-rest-allow-methods-delete, stable across every scan so you can filter or diff on it.

See every api check

Questions

How severe is REST endpoint allows DELETE?
VulnRadar rates this info severity in the api category. The severity is fixed per check, not scored per site, so the same finding is the same severity on every scan.
Does VulnRadar check for this automatically?
Yes. It runs as part of every scan under the check id api-rest-allow-methods-delete, which stays the same between runs so you can filter, diff, or gate CI on it.
Which standards does REST endpoint allows DELETE map to?
It maps to CWE-284. In the OWASP Top 10 it falls under A01:2021.

Missing a check?

The detection set is open. If you know a misconfiguration this does not catch, propose it: the issue template asks for the threat model, how to detect it, the false-positive risk, and a test fixture, which is the same thing a maintainer would have to work out anyway.

Propose a checkHow a check is built

Scan your own site for rest endpoint allows delete

VulnRadar runs this check and hundreds more against a URL in seconds. No agent to install, just paste a URL.

Or scan this site as a demoRead the docs

How to fix: REST endpoint allows DELETE | VulnRadar