/pf-code-review:pf-security-scanfrom pf-code-review
Scans PatternFly React code for XSS via dangerouslySetInnerHTML, unsanitized user input in tooltips/labels, and insecure href patterns. Use when auditing PF components for security vulnerabilities.
Ships in pf-code-review. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description, though model invocation is off: only you can start it.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Audit PatternFly React usage for security anti-patterns that turn UI components into XSS or open-redirect vectors. This skill focuses on PF-specific hotspots — not general app security (auth, CSRF, secrets).
When unfamiliar with a component's props or link-rendering behavior, consult available PatternFly documentation (component docs, design guidelines, or local references). This skill defines what to flag; docs fill in component-specific details. Ask the user for confirmation before any external documentation lookup that would transmit source context. Without documentation available, rely on the anti-pattern rules and component checklist in this skill.
@patternfly/react-core, @patternfly/react-table, @patternfly/react-component-groups, or @patternfly/react-templates.dangerouslySetInnerHTML| Severity | Flag when |
|---|---|
| CRITICAL | dangerouslySetInnerHTML / __html with unsanitized or untrusted non-constant HTML (no recognized sanitizer: DOMPurify, sanitize-html, or project-approved equivalent) |
| WARN | dangerouslySetInnerHTML with sanitization present but unverified config — confirm the sanitizer allows only safe tags |
Also flag PF components that accept HTML strings when fed unsanitized data:
innerHTML-style props or render callbacks that inject raw HTMLText, Title, Alert, or table cells without sanitizationUser-controlled strings rendered in PF components are XSS vectors when the data can contain HTML or script payloads.
| Severity | Component / prop | Flag when |
|---|---|---|
| CRITICAL | Tooltip / Popover — content, bodyContent, headerContent | Value from user/API state without sanitization |
| CRITICAL | Label, Badge, Chip, ChipGroup — children or text | User-controlled value rendered directly |
| HIGH | Alert — title, titleHeadingLevel, children | Message from API/error payload without sanitization |
| HIGH | Title, Text, Content — children | User or CMS content interpolated without escaping |
| HIGH | FormGroup — label, HelperText — children | Label or helper text from user input |
| HIGH | EmptyState — titleText, body | Dynamic content from external source |
| HIGH | DescriptionListDescription, DataListCell, Td | Cell/description values from API without sanitization |
| WARN | MenuItem, DropdownItem, SelectOption — children | Display text from user data (lower risk if React text nodes, but still audit source) |
Safe patterns (do not flag):
<Label>{userName}</Label>) — React escapes by defaultUnsafe patterns (always flag):
dangerouslySetInnerHTML in or near PF text surfacesinnerHTML assignment on DOM nodes inside PF component refsPF components frequently render links via Button, NavItem, BreadcrumbItem, DropdownItem, MenuItem, and standalone <a> inside PF layouts.
| Severity | Flag when |
|---|---|
| CRITICAL | href or to set to javascript: URL (literal or constructed) |
| CRITICAL | href built from unsanitized user input without URL validation |
| HIGH | href using data: scheme with non-image MIME types |
| HIGH | Dynamic href from API/params with no allowlist or URL constructor validation |
| WARN | target="_blank" without rel="noopener noreferrer" on external links |
| WARN | Button component="a" with dynamic href — same rules as <a> |
PF-specific link surfaces to check:
| Component | Props |
|---|---|
Button | href, component="a" |
NavItem / NavLink | to, href |
BreadcrumbItem | to, href |
DropdownItem | href, to |
MenuItem | to, href |
JumpLinksItem | href |
ExternalLink (if used) | href |
Safe patterns:
// Allowlisted origin
const safeUrl = allowedOrigins.includes(new URL(userUrl).origin) ? userUrl : '#';
// React Router internal navigation only
<NavItem to={`/users/${userId}`}>...</NavItem>
// External link with tab-nabbing protection
<Button component="a" href={trustedUrl} target="_blank" rel="noopener noreferrer">
Unsafe patterns:
// javascript: injection
<Button component="a" href={userSuppliedUrl}>...</Button>
// Unvalidated redirect
<DropdownItem href={searchParams.get('redirect')}>...</DropdownItem>
// String concat into href from API
<BreadcrumbItem href={`/docs/${apiResponse.path}`}>...</BreadcrumbItem>
For each finding:
[CRITICAL|HIGH|WARN] file/path.tsx:42 - Unsanitized API data in Tooltip content
Found: <Tooltip content={apiResponse.description}>
Risk: XSS — attacker-controlled HTML in tooltip popper
Fix: Sanitize with DOMPurify before render, or render as React text child if HTML is not required
End with:
Scanned: 18 files
Critical: 2 (across 1 file)
High: 3 (across 2 files)
Warnings: 1 (across 1 file)
Group findings by anti-pattern category (XSS, unsanitized input, insecure URLs) so patterns are visible.
new URL(), allowlist origins or paths, reject javascript:, data:, and protocol-relative // from untrusted input.rel="noopener noreferrer" to every target="_blank" link.Only apply fixes when the remediation is unambiguous. If a finding needs a product decision (e.g., rich-text support), report it and ask.
eval/cases/insecure-redirect-href/RedirectMenu.tsx (opens in a new tab)eval/cases/insecure-redirect-href/annotations.yaml (opens in a new tab)eval/cases/insecure-redirect-href/input.yaml (opens in a new tab)eval/cases/safe-react-text/SafeLabels.tsx (opens in a new tab)eval/cases/safe-react-text/annotations.yaml (opens in a new tab)eval/cases/safe-react-text/input.yaml (opens in a new tab)eval/cases/unsanitized-tooltip-xss/UserProfileCard.tsx (opens in a new tab)eval/cases/unsanitized-tooltip-xss/annotations.yaml (opens in a new tab)eval/cases/unsanitized-tooltip-xss/input.yaml (opens in a new tab)eval/eval.yaml (opens in a new tab)references/anti-patterns.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
5 skills in this plugin
/pf-adversarial-reviewReview PatternFly React components for unhandled edge cases and missing defensive code. Use when auditing components for production readiness or stress-testing before a release./pf-i18n-auditAudit PatternFly React code for i18n readiness — hardcoded user-facing strings, concatenation anti-patterns, locale-dependent formatting, and RTL-unsafe CSS. Use when reviewing code for global deployment or auditing i18n compliance./pf-reviewRun all PatternFly compliance checks on a project — imports, components, colors, legacy CSS, and security. Use when auditing PF code, before merging PRs, or for comprehensive compliance review./pf-state-auditAudit PatternFly React components for missing UI states — loading, error, empty, and unauthorized. Use when reviewing data-dependent components or auditing a page for production readiness.npx claudepluginhub rh-uxd/ai-helpers --plugin pf-code-reviewOther plugins' skills for the same job