Logo van Frontend Security

Frontend Security

Community
MiladJoodi
frontend-security

Secure-by-default guidance for writing, reviewing, and fixing frontend code in React and Next.js (App Router) - XSS and unsafe HTML, dangerouslySetInnerHTML, DOMPurify, URL and redirect validation, Content Security Policy with nonces, security headers (HSTS, nosniff, frame-ancestors, Referrer-Policy, Permissions-Policy), CORS, cookies and token storage, CSRF, Server Action and Route Handler hardening, third-party scripts and SRI, npm supply-chain risk, form and input validation, file uploads, payment verification and webhooks, and OTP/SMS login. Use this skill whenever the user mentions XSS, CSP, CSRF, CORS, cookies, JWT or token storage, sanitizing HTML, security headers, secure login, payment callbacks, uploads, or asks for a security review or audit of frontend code. Also use it when writing code that renders user-controlled content, handles sessions or auth, or accepts payments, even if the user never says "security".

Overzicht

UitgeverMiladJoodi
Repositoryskills
Skillnaamfrontend-security
Sterren
24
Forks
1
Meegeleverde bestanden
8
LicentieMIT
Links
  • Instructies in Markdown

    Het model laadt het bestand SKILL.md alleen als dat nodig is. Dat kost dus alleen tokens als een verzoek daadwerkelijk bij de skill past.

  • Werkt met elk LLM

    AI-skills bestaan uit instructies in gewone Markdown, niet uit aanbiederspecifieke code. Daardoor werken ze met GPT, Claude, Gemini, Grok of een lokaal model.

  • Meegeleverde bestanden: 8

    Scripts, sjablonen en referentiemateriaal die het model tijdens het werken kan lezen. De bestanden kunnen alleen worden gelezen en worden nooit uitgevoerd.

  • Open source

    Gepubliceerd door MiladJoodi op GitHub. Bekijk de bronbestanden voordat je de skill installeert.

Installatie

Installeer de AI-skill Frontend Security in TypingMind om deze met elk LLM te gebruiken, of voeg de skill toe aan een andere agent die SKILL.md kan lezen.

1

Installeren in TypingMind

TypingMind installeert een skill rechtstreeks vanuit de GitHub-map. De app leest SKILL.md, bundelt de bijbehorende bestanden en slaat het resultaat lokaal op.

  1. Open de app en ga naar Plug-ins → Skills.
  2. Kies "Installeren via GitHub".
  3. Plak de onderstaande URL van de skillmap en bevestig.
    https://github.com/MiladJoodi/skills/tree/main/skills/frontend-security
  4. Schakel de skill in voor elke chat waarin je de skill wilt kunnen gebruiken.
Plug-ins → Skills → Skill toevoegen → Via GitHub-URL. Plak vervolgens de map-URL en druk op Doorgaan.
2

Installeren in een andere agent

Elke agent die het Agent Skills-formaat kan lezen, kan deze skill gebruiken — kopieer de map naar de skillmap van die agent.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/MiladJoodi/skills.git /tmp/skills
mkdir -p .claude/skills
cp -r /tmp/skills/skills/frontend-security .claude/skills/frontend-security
Start Claude Code na het kopiëren opnieuw op, zodat de nieuwe skill wordt herkend.

Gebruik deze skill in TypingMind

Schakel Frontend Security in voor een chat naar keuze in TypingMind en het model doet de rest. De naam en beschrijving staan in de systeemprompt. Zodra een verzoek bij de skill past, laadt het model zelf de volledige instructies. Je hoeft de skill nooit handmatig aan te roepen. Pas als het model de skill daadwerkelijk gebruikt, kost dat tokens.

Het model laadt Frontend Security automatisch zodra een verzoek erbij past.

Werkt met elk AI-model

AI-skills zijn gewone Markdown-instructies in plaats van aanbiederspecifieke code. Daardoor is Frontend Security niet gebonden aan het model waarvoor de skill is geschreven. Installeer de skill één keer in TypingMind en gebruik deze met GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama of een lokaal model dat je zelf draait — allemaal met je eigen API-sleutels.

  • Alleen geladen wanneer nodig

    De systeemprompt bevat alleen de naam en beschrijving. De instructies worden bij het eerste bijpassende verzoek opgehaald, dus een ongebruikte skill kost niets.

  • Wissel van model tijdens een chat

    Omdat de skill uit instructies bestaat en niet uit code, blijft deze werken als je van model wisselt — het volgende model leest hetzelfde SKILL.md-bestand.

Skillinstructies

Dit is de inhoud van SKILL.md die het model laadt. Lees deze vóór de installatie — een skill bestaat uit instructies die je model zal volgen.

Frontend Security (React / Next.js)

Rules for writing, reviewing, and fixing frontend code so it is secure by default. Prefer small, targeted changes that preserve existing behavior. Concrete fixes over theory.

Last reviewed: October 2026. Version-sensitive details (Next.js APIs, header values) change; see "Verify before asserting" below.

How to work

  1. Inspect first. Read package.json (Next.js and React versions), the router in use (App Router or Pages), the auth model (cookie session or bearer token), and where headers are set today (proxy.ts / middleware.ts, next.config, reverse proxy, hosting platform). Do not add a protection that already exists or conflicts with one that does.
  2. Trace untrusted data from source (user input, URL, API, CMS, uploads, third parties) to sink (DOM, URL, cookie, DB, redirect, file path). Security bugs live at the sinks.
  3. Pick the mode: implementing, fixing, or auditing. For audits, report each finding with severity, file and line, evidence, and a concrete fix. Do not pad the report with generic advice.
  4. Make the smallest secure change. Do not rewrite an auth or deployment architecture when a targeted fix works.
  5. Verify, then report. Say what you checked and what you could not. Never claim something is fixed because a config line exists; confirm the effective behavior (response headers, rendered HTML, test results).

Ask the user only what changes the answer: cookie session vs bearer token, Next.js version, where headers are configured, whether user-supplied HTML is a real requirement. Never ask for real secrets, production tokens, or session cookies.

Non-negotiable rules

  1. The browser is untrusted. Client-side validation, hidden buttons, disabled controls, route guards, and TypeScript types are UX, not security. Enforce every security decision on the server.
  2. Render untrusted data as text. Any HTML sink (dangerouslySetInnerHTML, innerHTML, and similar) needs a maintained sanitizer with a restrictive allowlist, applied at the render boundary. Never use regex to sanitize.
  3. URLs from data are untrusted. Allowlist protocols (http:, https:, optionally mailto:) before putting them in href or src. Validate redirect targets against relative paths or an explicit host allowlist.
  4. Keep credentials out of JavaScript. Session and refresh tokens belong in HttpOnly; Secure; SameSite cookies, not localStorage, sessionStorage, URLs, or logs.
  5. Cookie-authenticated mutations need CSRF defense and authorization. SameSite helps but does not cover everything. Never change state on GET.
  6. Treat every Server Action and Route Handler as a public HTTP endpoint. Authenticate, authorize against the specific resource (ownership, tenant), and validate input with a schema, every time.
  7. Use a nonce-based CSP with 'strict-dynamic', rolled out via Report-Only first. Do not add 'unsafe-inline' or 'unsafe-eval' to scripts just to silence errors. Nonces require dynamic rendering.
  8. Secrets stay on the server. Anything in the client bundle or in NEXT_PUBLIC_* is public.
  9. Money flows are verified server-to-server. Never trust a redirect, query string, or client-reported amount. Compute amounts on the server, verify with the provider, make fulfillment idempotent.
  10. OTP and login endpoints are attack surface. Rate-limit, cap attempts, expire and hash codes, return generic responses (no account enumeration).
  11. Uploads are hostile. Validate content (not just extension or client MIME type), generate storage keys server-side, keep storage private, treat SVG and HTML as active content.
  12. Dependencies are code you run. Commit the lockfile, install from it in CI, audit, and review new packages (especially in auth and payment paths).
  13. Do not log secrets or personal data: passwords, OTPs, tokens, cookies, Authorization headers, card data, government IDs.

Where to read next

Read only the reference that matches the task:

Task touchesRead
HTML rendering, Markdown, rich text, links, redirects, iframes, postMessage, JSON-LDreferences/xss-and-urls.md
CSP, nonces, security headers, CORS, proxy.ts / middleware.tsreferences/csp-headers-cors.md
Sessions, cookies, tokens, CSRF, Server Actions, Route Handlers, authorizationreferences/auth-cookies-csrf.md
Forms, schemas, request limits, file uploads, object storagereferences/input-validation-uploads.md
Payment callbacks, webhooks, OTP / SMS loginreferences/payments-and-otp.md
Third-party scripts, SRI, npm dependencies, supply chainreferences/third-party-and-supply-chain.md
Finishing a change or running an auditreferences/review-checklist.md

For a full audit, read the checklist first, then the references for each area found in the code.

Verify before asserting

  • Next.js naming: current Next.js docs use proxy.ts exporting proxy for the nonce pattern; older versions use middleware.ts exporting middleware. Check the installed version and the official docs before choosing.
  • Header values and directives: if unsure about a directive or value, check MDN or the framework docs instead of guessing.
  • Provider APIs (payments, SMS, storage): use the provider's current official documentation. Do not invent response codes, field names, or amount units.
  • Placeholders: never ship placeholder SRI hashes, fake keys, or invented configuration as if they were real.
  • If something cannot be verified in this session, say so explicitly in the final message.

Meegeleverde bestanden

Zolang de skill geladen is, leest het model deze bestanden als dat nodig is. Het model kan ze alleen lezen; ze worden nooit uitgevoerd.

Veelgestelde vragen

Wat doet de AI-skill Frontend Security?

Secure-by-default guidance for writing, reviewing, and fixing frontend code in React and Next.js (App Router) - XSS and unsafe HTML, dangerouslySetInnerHTML, DOMPurify, URL and redirect validation, Content Security Policy with nonces, security headers (HSTS, nosniff, frame-ancestors, Referrer-Policy, Permissions-Policy), CORS, cookies and token storage, CSRF, Server Action and Route Handler hardening, third-party scripts and SRI, npm supply-chain risk, form and input validation, file uploads, payment verification and webhooks, and OTP/SMS login. Use this skill whenever the user mentions XSS...

Waarom Frontend Security gebruiken in TypingMind?

Omdat je deze skill één keer installeert en met elk model kunt gebruiken. Frontend Security bestaat uit gewone Markdown in plaats van aanbiederspecifieke code. Dezelfde skill werkt dus met GPT-5, Claude, Gemini, Grok of een lokaal model. Ook als je midden in een chat van model wisselt, blijft de skill werken. TypingMind werkt met je eigen API-sleutels, dus je betaalt aanbieders rechtstreeks in plaats van een abonnement per gebruikersplek af te sluiten. Je skills en chats blijven in je eigen opslag.

Hoe installeer ik Frontend Security in TypingMind?

Open Plug-ins → Skills → Installeren vanaf GitHub in TypingMind en plak https://github.com/MiladJoodi/skills/tree/main/skills/frontend-security. TypingMind leest het bestand SKILL.md, bundelt de bijbehorende bestanden en installeert het geheel als een skill die je per chat kunt inschakelen.

Welke AI-modellen kunnen Frontend Security gebruiken?

Elk model dat je in TypingMind koppelt. AI-skills bestaan uit gewone Markdown-instructies in plaats van aanbiederspecifieke code. GPT, Claude, Gemini, Grok en lokale modellen kunnen deze skill dus allemaal laden wanneer een verzoek erbij past.

Hoeveel AI-modellen kan ik met Frontend Security gebruiken?

Zoveel als je wilt. Je kunt Frontend Security gebruiken met elk model dat skills ondersteunt, zoals GPT, Claude, Gemini, Grok, DeepSeek, Mistral of Llama. Allemaal in TypingMind met je eigen API-sleutels.

Is de AI-skill Frontend Security gratis?

Ja. Deze skill is door MiladJoodi op GitHub gepubliceerd onder de licentie MIT. Je betaalt alleen je eigen AI-aanbieder voor de tokens die je gebruikt.

Wat zijn AI-skills?

Een AI-skill is een herbruikbare bundel instructies die een AI-model leert hoe het één specifieke taak moet uitvoeren. De skill volgt het open Agent Skills-formaat: het bestand SKILL.md bevat de naam en beschrijving van de skill. Daarnaast kan de skill scripts, sjablonen of referentiebestanden bevatten die het model nodig heeft. Het model leest de instructies alleen als je verzoek bij de skill past. Een geïnstalleerde skill kost dus niets zolang deze niet wordt gebruikt.

Waarin verschillen AI-skills van plug-ins of MCP-servers?

Een plug-in of MCP-server geeft een model nieuwe tools om aan te roepen: code die ergens wordt uitgevoerd en een resultaat teruggeeft. Een AI-skill geeft het model juist kennis en een werkwijze: hoe het een taak moet aanpakken, welke stappen het moet volgen en hoe goede uitvoer eruitziet. Skills bestaan uit gewone Markdown en hebben dus geen server, API-sleutel of runtime nodig. Ze werken met elk model.

Bekijk alles

Maak nu je eigen AI-werkruimte

Schrijf je in voor onze nieuwsbrief en blijf op de hoogte van nieuwe functies en toekomstige weggeefacties 👇