Back to skill

Security audit

React Best Practices 2 0.1.0

Security checks for vulnerabilities and agentic risk

Overview

This is mostly a React/Next.js guidance skill, but some recommended examples could lead agents to write unsafe code involving session cookies, inline scripts, and shared caches.

Review this skill before installing. It is documentation-only and not directly malicious, but agents following it may copy unsafe patterns into production code. Avoid logging raw cookies or tokens, do not use `dangerouslySetInnerHTML` with dynamic data, scope cross-request caches carefully, and use pinned/project-local tooling instead of floating `npx` commands.

Vulnerability Patterns
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
Findings (2)

T09 · Insecure Skill Coding Practices

Error
Location
rules/server-after-nonblocking.md:46
Finding

Raw Session Cookie Disclosed to an Unspecified Logging or Analytics Sink

Content
View full analysis
Remediation
View remediation
{ const userAgent = (await headers()).get('user-agent') || 'unknown' await logUserAction({ event: 'resource-updated', userAgent, }) }) ``` - Remove the vulnerable duplicate from both `rules/server-after-nonblocking.md` and the generated `AGENTS.md`. ]]>

T08 · Insecure Dependencies

Warning
Location
rules/rendering-svg-precision.md:27
Finding

Unpinned Third-Party Package Download and Execution Through npx

Content
View full analysis
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Output HandlingUnvalidated Output Injection, Cross-Context Output, Unbounded Output
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (11)

Unvalidated Output Injection

High
Category
Output Handling
Confidence
97% confidence
Finding

dangerouslySetInnerHTML is a direct code-injection sink. In a skill intended for AI agents, demonstrating this sink as a recommended pattern materially increases the chance that future generated code will route untrusted values into inline scripts, enabling DOM-based or reflected XSS with session theft, account compromise, or arbitrary script execution in the browser.

Content

Scanner excerpt · AGENTS.md (reported line 2138)May include surrounding context.

md
{children}
      </div>
      <script
        dangerouslySetInnerHTML={{
          __html: `
            (function() {
              try {

Unvalidated Output Injection

High
Category
Output Handling
Confidence
92% confidence
Finding

The skill explicitly recommends using dangerouslySetInnerHTML to inject an inline script, normalizing a pattern that bypasses React's default escaping and weakens CSP posture. While the shown snippet is static and not directly user-controlled, this guidance can be copied into real applications and later extended with dynamic values, creating a credible XSS sink and increasing the chance of unsafe script injection.

Content

Scanner excerpt · rules/rendering-hydration-no-flicker.md (reported line 63)May include surrounding context.

md
{children}
      </div>
      <script
        dangerouslySetInnerHTML={{
          __html: `
            (function() {
              try {

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The manifest says this skill is for React and Next.js performance optimization guidelines, but this section teaches authentication, authorization, input validation, and protection of Server Actions as public endpoints. Those are legitimate engineering topics, but they are not directly justified by the skill's stated purpose of performance-focused code writing/review/refactoring guidance.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

This guidance recommends raw inline script injection with dangerouslySetInnerHTML, which normalizes a high-risk capability outside the skill's stated performance-optimization scope. Even though the example uses static code, agents following this pattern may generalize it to dynamic values from cookies, query params, or user preferences, creating an XSS sink in React/Next.js applications.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The example shows dangerouslySetInnerHTML without any warning about the XSS risk or constraints on allowed data sources. In an agent-focused skill, omission of those guardrails is dangerous because automated refactoring or code generation may copy the pattern into contexts where the script body includes attacker-controlled input.

Content

No source excerpt is available for this finding.

Rp1

Medium
Category
MCP Rug Pull
Confidence
70% confidence
Finding

npx commands without a version suffix (e.g. @1.0.0) create a rug-pull risk if the upstream server is compromised and publishes a malicious update.

Content

No source excerpt is available for this finding.

Rp1

Medium
Category
MCP Rug Pull
Confidence
70% confidence
Finding

npx commands without a version suffix (e.g. @1.0.0) create a rug-pull risk if the upstream server is compromised and publishes a malicious update.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The file states that developers should use useTransition instead of manual loading state for loading indicators, and the 'correct' example wraps an async fetch in startTransition. In React, transitions are intended for marking state updates as non-urgent; they do not make the network request itself a transition, so presenting this as a general replacement for loading state is an intent-level contradiction between the guidance and what the code actually demonstrates.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The example explicitly recommends logging a session cookie value together with user-agent data in a background task, but provides no warning about minimizing, redacting, or avoiding sensitive identifiers. Session identifiers are security-sensitive and can enable account correlation, tracking, or misuse if logs are exposed, and moving the logging to after() makes it easy for developers to adopt the pattern without considering privacy or retention controls.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The guidance recommends cross-request in-memory caching of user records keyed only by user ID, but it does not warn that shared process memory can retain user data across requests, serve stale authorization-sensitive data, or leak data when cached objects are reused in the wrong security context. In a React/Next.js best-practices skill, this is more dangerous because readers may copy the pattern directly into production server code and assume it is a generally safe optimization.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
87% confidence
Finding

This markdown skill describes a pattern that reads from localStorage and injects a synchronous inline script before hydration. While the behavior is central to the example, the document does not include any warning or disclosure about accessing client-side stored data or the implications of using inline script execution.

Content

No source excerpt is available for this finding.