agentleFS
awarexoneawarexone/AXguard/xss-analysis/SKILL.md

xss-analysis

Skill18 starsChanged 3 months agoMITView on GitHub

Analyze and validate cross-site scripting in web/UI code — use when reviewing HTML sinks, DOM APIs, template escaping, dangerouslySetInnerHTML, or reflected/stored XSS paths (CWE-79 / A03:2021).

The file

We split this skill into the rules it gives an agent

5 rules. About 0 are common, 1 is distinctive, and 4 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    After axguard hits xss.* findings.

    line 41
  2. Very specific:

    Check framework escape defaults vs deliberate bypass (|safe, raw, bypassSecurityTrustHtml).

    line 69
  3. Very specific:

    Check CSP: is it enforced?

    line 70
  4. Distinctive:

    Prefer framework text-binding.

    line 94
  5. Very specific:

    Avoid javascript: / data URL assignment from user input.

    line 98

≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

XSS Analysis

Purpose

Teach the agent to reason about Cross-Site Scripting (XSS): untrusted data reaches an HTML/JS execution or DOM interpretation sink without context-correct encoding, enabling script execution in a victim browser.

When to Use / When Not to Use

Use when:

  • Reviewing templates, React/Vue/Svelte markup, innerHTML, document.write, dangerouslySetInnerHTML, URL/javascript: sinks, or markdown/HTML renderers.
  • After axguard hits xss.* findings.
  • Auth/session cookies lack HttpOnly and HTML reflection is nearby (session theft impact).

Do not use when:

  • Pure server-to-server JSON APIs with no HTML consumers (prefer api-security for injection into other sinks).
  • Content is forced through a known safe text node API with no attribute/URL context issues and no raw HTML path.

Security Concepts

XSS is a browser trust-boundary failure. Context matters: HTML body, attribute, JS string, URL, CSS, and JSON-in-script each need different encoding. Framework auto-escaping helps only when you stay on the safe API path.

Threat Model

Attacker goals:

  1. Steal session tokens / local storage secrets.
  2. Act as the victim (CSRF-like actions from the victim origin).
  3. Deface, phish, or pivot into admin UI.
  4. Chain with CSP gaps, prototype pollution gadgets, or open redirects.

Analysis Workflow

Trace source → transform → sink with context:

  1. Find sinks: innerHTML, outerHTML, document.write, insertAdjacentHTML, dangerouslySetInnerHTML, v-html, |safe, Markup(, unescaped {{, eval/Function on user strings, location/href/src assignments.
  2. Find sources: query/body/path, stored user content, webhook payloads, markdown, email HTML, AI/tool output rendered in UI.
  3. Identify output context (HTML text, attribute, JS, URL). Wrong encoder = still XSS.
  4. Check framework escape defaults vs deliberate bypass (|safe, raw, bypassSecurityTrustHtml).
  5. Check CSP: is it enforced? Does it allow unsafe-inline / wildcards that neutralize mitigation?
  6. Classify: reflected vs stored vs DOM-based; note if HttpOnly / SameSite reduce cookie theft.
  7. For DOM XSS: confirm attacker-controlled string reaches sink in the browser without server re-encoding.

Evidence Requirements

Hypothesis becomes HIGH/CONFIRMED only with:

  • File:line of sink and source of attacker influence
  • Proof of missing/incorrect encoding for that context
  • Realistic execution path (not dead template)
  • Impact note (session, account takeover, admin UI)

False Positive Controls

Drop or downgrade when:

  • Value is constrained to a safe allowlist (enum, UUID, integer) before render
  • Safe text APIs only (textContent, escaped templates) with no raw HTML path
  • Markdown renderer is hardened and HTML disabled
  • Finding is in intentional XSS test fixtures (unless auditing fixtures)

Remediation

  1. Prefer framework text-binding; never concatenate untrusted data into HTML.
  2. Context-correct encoding libraries for any residual HTML.
  3. Sanitize HTML with a maintained allowlist sanitizer if rich text is required.
  4. Set CSP (nonces/hashes; avoid unsafe-inline where possible), HttpOnly + Secure + SameSite cookies.
  5. Avoid javascript: / data URL assignment from user input.

Verification

Detect → Encode/sanitize sink → Re-run axguard → Confirm no raw sink path → Add regression tests for reflected/stored strings

Related Skills

  • prototype-pollution — client gadgets that unlock DOM XSS
  • graphql-security / api-security — stored fields later rendered in UI
  • security-triage, security-remediation

Framework Mapping

  • CWE-79
  • OWASP Top 10 2021 A03:2021 Injection

References

Research Provenance

Primary sources:

  • OWASP Top 10:2021 A03 (accessed 2026-09-15)
  • CWE-79 (accessed 2026-09-15)

Secondary / internal:

  • AXGuard rules/xss.json, /axguard-xss
  • AwareXone Agentic-Bug-Hunter XSS methodology (concepts only; not copied)

Datasets:

  • UVID HF dataset — category linkage concepts only (MIT license metadata review 2026-09-15)

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.