Skip to content
Skills Library
Security · Review & audit

fe-security

/fe-security

Keeps front-end code from opening security holes in any stack - XSS sinks (innerHTML, dangerouslySetInnerHTML, v-html, {@html}) and sanitizing, no eval, postMessage origins, secrets kept out of public env variables, CSP and HTTP-only headers, SRI, window.open, HTTPS. Use when rendering user or CMS content, embedding third parties, adding env variables or headers, or when asked "is this safe".

Licence
MIT
Last repository change
11.11.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
2
Scripts
0
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 11.11.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What it does and when to use it

Keeps front-end code from opening security holes in any stack - XSS sinks (innerHTML, dangerouslySetInnerHTML, v-html, {@html}) and sanitizing, no eval, postMessage origins, secrets kept out of public env variables, CSP and HTTP-only headers, SRI, window.open, HTTPS. Use when rendering user or CMS content, embedding third parties, adding env variables or headers, or when asked "is this safe".

Triggers from the description

is this safe
Original author description

Keeps front-end code from opening security holes in any stack - XSS sinks (innerHTML, dangerouslySetInnerHTML, v-html, {@html}) and sanitizing, no eval, postMessage origins, secrets kept out of public env variables, CSP and HTTP-only headers, SRI, window.open, HTTPS. Use when rendering user or CMS content, embedding third parties, adding env variables or headers, or when asked "is this safe".

How it works

  1. Rules
  2. Do this
  3. Check
  4. References
Original SKILL.md headings · 37 lines, 409 words
SKILL.md preview
---
name: fe-security
description: Keeps front-end code from opening security holes in any stack - XSS sinks (innerHTML, dangerouslySetInnerHTML, v-html, {@html}) and sanitizing, no eval, postMessage origins, secrets kept out of public env variables, CSP and HTTP-only headers, SRI, window.open, HTTPS. Use when rendering user or CMS content, embedding third parties, adding env variables or headers, or when asked "is this safe".
license: MIT
compatibility: Any agent that reads Agent Skills. The audit command needs Node.js 20 or newer; the page audit needs a local Chrome.
metadata:
  title: Front-end security
  area: quality
  lane: C
  requires: web
  globs: "**/*.html **/*.jsx **/*.tsx **/*.js **/*.vue **/*.svelte **/*.astro **/*.component.html"
  rules: "security/raw-html-sink security/no-eval security/postmessage-origin security/no-secrets-in-client-env security/sri-cdn security/window-open-noopener security/csp-meta-ignored security/csp-strict security/https-only"
  version: 0.1.0
---

# Front-end security

Read `.frontend-skills/profile.json` and `.frontend-skills/lessons.md` first when they exist; a confirmed lesson (for example the project's sanitizer) wins over this skill.

## Rules

- Never pass user, CMS or API data to a raw HTML sink unsanitized; render text, or sanitize with DOMPurify (security/raw-html-sink).
- Never run strings as code: no `eval`, `new Function`, string timers (security/no-eval).
- `postMessage` names an exact origin; window message listeners check `event.origin` (security/postmessage-origin).
- Secrets never use a public env prefix (`NEXT_PUBLIC_`, `VITE_`, `PUBLIC_`); they stay in server code (security/no-secrets-in-client-env).
- Versioned CDN files carry `integrity` and `crossorigin`, or are self-hosted (security/sri-cdn).
- `window.open` to other sites passes `noopener,noreferrer` (security/window-open-noopener).
- `frame-ancestors`, `X-Frame-Options`, HSTS and CSP reporting are HTTP headers, never meta tags (security/csp-meta-ignored).
- Production sends a strict CSP with nonces or hashes (security/csp-strict); everything loads over HTTPS (security/https-only).
- Validate URLs before binding them to `href` or `src`: allow `https:`, `http:`, `mailto:`, `tel:` only.
- Auth cookies are set by the server with `Secure`, `HttpOnly` and `SameSite`; never write tokens into the DOM or URLs.
- Never say code "is secure"; say what was checked and what a person must review.

## Do this

1. Search the change for sinks: `innerHTML`, `outerHTML`, `insertAdjacentHTML`, `document.write`, `dangerouslySetInnerHTML`, `v-html`, `{@html}`, `set:html`, `bypassSecurityTrust`. For each, trace where the value comes from.
2. For rich text from a CMS or Markdown, sanitize once at a single helper (DOMPurify, configured once), and use only that helper.
3. For new environment variables, decide server or browser first; give browser ones the framework prefix only if they are meant to be public.
4. For a new third party: self-host or pin with SRI, load it `async`, list it in the CSP, and isolate untrusted HTML in a sandboxed `iframe`.
5. Set security headers in the host configuration (`_headers`, `vercel.json`, `next.config` `headers()`, middleware), and verify them on the deployed response.

## Check

- `npx github:dawidolko/frontend-skills audit --changed` finds unsanitized HTML sinks, `eval`, unchecked `postMessage`, secret-looking public env variables, CDN files without SRI, `window.open` without `noopener` and headers placed in meta tags.
- `audit --url <page>` adds Lighthouse's HTTPS and CSP checks on the rendered page.
- Run the package manager's audit (`npm audit --audit-level=high`) in CI. A person reviews authentication, authorisation, data flows and server configuration.

## References

- [references/security.md](references/security.md): sink table per framework, DOMPurify use, strict CSP recipe, Trusted Types, header placement table, cookies, URL validation, supply chain. Read it when handling user content or setting headers.
Files in this package (2)
  • SKILL.md 4 KB
  • references/security.md 5 KB

Versions

The database has no other skills named fe-security.

Database snapshot: 13.11.2026 · package version 51c8647c405f (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 100frontend-security
    Hardens browser code against XSS, token theft, CSRF, clickjacking and supply-chain attacks (safe DOM sinks, sanitization, strict CSP, Trusted Types, token storage, SRI, postMessage checks). Use when writing or reviewing frontend code that renders user content, handles auth…
  • 100watchdog-go-frontend
    On-demand frontend audit (XSS sinks, CSP, postMessage, token storage, third-party scripts). Use for /watchdog-go-frontend. Defensive use only.
  • 90frontend-security
    Use this skill when the user says 'XSS', 'CSP', 'CSRF', 'SRI', 'secure cookies', 'security headers', 'frontend security', 'sanitize input', 'content security policy', 'cross-site scripting', 'cross-site request forgery', or when auditing frontend security. This skill enforces:…
  • 100client-side-security
    Apply when reviewing or writing browser-facing code that handles user input, renders HTML, sets cookies, or loads third-party scripts. Covers XSS, CSRF, CSP, clickjacking, XS-Leaks, and HTTP security headers.
  • 95memstack-security-csp-headers
    Use this skill when the user says 'CSP', 'Content-Security-Policy', 'security headers', 'HSTS', 'X-Frame-Options', 'clickjacking', 'unsafe-inline', 'unsafe-eval', or needs to audit, generate, or fix HTTP security headers for a web application. Do NOT use for API route audits or dependency scanning.
  • 100rendering-untrusted-content
    Renders stored, authored, or imported content into HTML without shipping XSS — auditing every autoescape bypass (|safe, Markup, innerHTML), sanitizing Markdown output with an allowlist, escaping on both the server and the DOM, and writing sanitization tests that assert on the…

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.