Skip to content
Back to skills

React Security

ASecurity

This is an IDOR/BOLA authorization vulnerability: the backend trusts the `userId` from the URL. Assumption: the URL is something like `/users/:userId`. Fix authorization server-side on every affected endpoint: ```ts // GET /api/users/:userId const requestedId = req.params.userId; const authenticatedUser = req.user; if (authenticatedUser.id !== requestedId && !authenticatedUser.roles.includes("admin")) { return res.status(404).json({ error: "Not found" }); // or 403 } return res.json(await use...

  • 584 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added September 5, 2026
developmentrustreactapibackend

Works with

  • cli
  • api

Security analysis

A100/100

Pro scans all 11 files and shows the line behind each finding

Scanned September 5, 2026

npx -y skills add HoangNguyen0403/agent-skills-standard --skill react-security --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of React Security?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for React Security
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/hoangnguyen0403-react-security-a1f28263/badge)](https://www.skillsdirectory.com/skills/hoangnguyen0403-react-security-a1f28263)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
This is an IDOR/BOLA authorization vulnerability: the backend trusts the `userId` from the URL.

Assumption: the URL is something like `/users/:userId`.

Fix authorization server-side on every affected endpoint:

```ts
// GET /api/users/:userId
const requestedId = req.params.userId;
const authenticatedUser = req.user;

if (authenticatedUser.id !== requestedId && !authenticatedUser.roles.includes("admin")) {
  return res.status(404).json({ error: "Not found" }); // or 403
}

return res.json(await userService.getPrivateData(requestedId));
```

Prefer deriving the ID from the authenticated session when users may only access their own data:

```ts
const user = await userService.getPrivateData(req.user.id);
```

Do not rely on React route guards or hidden UI controls; **no client logic for permissions**. Backend authorization must validate ownership or an explicit role for every read and write operation, including nested resources and alternate API routes.

Also:

- Store sessions/JWTs in `HttpOnly` and `Secure` cookies, never `localStorage`.
- Use `SameSite=Strict` where applicable and CSRF tokens for state-changing requests.
- Validate and sanitize the URL ID and all other inputs on the backend.
- Add tests proving user A cannot access user B’s data, including guessed IDs, UUIDs, alternate methods, and missing/invalid IDs.
- Run `npm audit` or `pnpm audit`, and **pin specific dependency versions**.

Files in this skill

  • eval-1.baseline.md554 B
  • eval-1.with-skill.md1 KB
  • eval-2.baseline.md308 B
  • eval-2.with-skill.md1.4 KB
  • eval-3.baseline.md578 B
  • eval-3.with-skill.md669 B
  • trigger-1.md113 B
  • trigger-2.md133 B
  • trigger-3.md154 B
  • trigger-4.md164 B

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.