T09 · Insecure Skill Coding Practices
- Location
references/route-handlers.md:81- Finding
Authentication Cookie Token Disclosed in JSON Response
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This is mostly a Next.js documentation skill, but it needs Review because some examples could teach agents to expose session/config data and its install/migration commands run mutable remote packages.
Review before installing. Prefer pinned installer and codemod versions, avoid copying the example that returns cookie tokens or server-only environment values to clients, and add privacy/consent checks before using analytics, tag-manager, maps, or embedded third-party scripts.
references/route-handlers.md:81Authentication Cookie Token Disclosed in JSON Response
README.md:35Unpinned Third-Party Packages Executed Through npx
Model output is used without validation or sanitization. Unvalidated output injected into downstream contexts (SQL, shell, HTML) enables injection attacks and arbitrary code execution.
// BAD: Missing id
<Script dangerouslySetInnerHTML={{ __html: 'console.log("hi")' }} />
// GOOD: Has id
<Script id="my-script" dangerouslySetInnerHTML={{ __html: 'console.log("hi")' }} />
Model output is used without validation or sanitization. Unvalidated output injected into downstream contexts (SQL, shell, HTML) enables injection attacks and arbitrary code execution.
// BAD: Missing id
<Script dangerouslySetInnerHTML={{ __html: 'console.log("hi")' }} />
// GOOD: Has id
<Script id="my-script" dangerouslySetInnerHTML={{ __html: 'console.log("hi")' }} />
The README instructs users to execute remote package/code via npx add from a GitHub URL without pinning to a specific immutable version, tag, or commit. This creates a supply-chain risk because future upstream changes or compromise of the referenced source could cause different code to run than what was originally reviewed.
Using npx clawhub@latest install nextjs pulls and executes the latest version of a remote package at runtime, which is inherently mutable. If the package is updated maliciously or compromised, users following the README may execute attacker-controlled code.
Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.
From your project root:
mkdir -p .cursor/skills
cp -r ~/.ai-skills/skills/frontend/nextjs .cursor/skills/nextjs
Skill enumerates or reads other installed skills. Access to other skills' SKILL.md files or the skills directory reveals prompt instructions, capabilities, and secrets that should be invisible to peer skills.
From your project root:
mkdir -p .claude/skills
cp -r ~/.ai-skills/skills/frontend/nextjs .claude/skills/nextjs
Skill enumerates or reads other installed skills. Access to other skills' SKILL.md files or the skills directory reveals prompt instructions, capabilities, and secrets that should be invisible to peer skills.
mkdir -p ~/.claude/skills
cp -r ~/.ai-skills/skills/frontend/nextjs ~/.claude/skills/nextjs
Skill selects an external model or provider that may use a different account or billing plan than the operator expects. Undisclosed model switches can cause unexpected cost or quota consumption.
---
name: nextjs
model: standard
description: Next.js App Router best practices — Server Components, data fetching, caching, routing, middleware, metadata, error handling, streaming, Server Actions, and performance optimization for Next.js 14-16+.
keywords: [next.js, nextjs, app router, server components, rsc, server actions, streaming, suspense, parallel routes, intercepting routes, metadata, middleware, caching, revalidation, image optimization, font optimization]
user-invocable: false
The installation command uses npx clawhub@latest install nextjs, which executes a remote package at its latest published version rather than a pinned, reviewed release. This creates a supply-chain risk: a compromised or malicious upstream release could execute arbitrary code on the user's machine at install time.
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.
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
const users = await db.user.findMany();
// Or fetch from external API
const posts = await fetch('https://api.example.com/posts').then(r => r.json());
return (
<ul>
The documentation instructs users to run npx @next/codemod@latest upgrade, which fetches and executes remote package code without pinning to a specific reviewed version. If the upstream package is compromised, malicious, or changed unexpectedly, users could execute attacker-controlled code during the migration step. In a developer skill focused on framework best practices, this is more dangerous because readers are likely to copy-paste the command directly into a trusted shell environment.
The example reads a token from cookies and returns it in a JSON response, which normalizes exposing credential material back to the client. In a documentation skill about Next.js route handlers, readers may copy this pattern into real APIs, causing session tokens or auth secrets to be disclosed to browsers, logs, intermediaries, or attacker-controlled scripts.
This markdown file recommends integrating Google Analytics, Google Tag Manager, YouTube embeds, Google Maps embeds, and other third-party scripts, all of which can transmit user or system data to external services. The documentation does not include any warning about privacy impact, consent requirements, or the fact that these integrations may collect user data.
The runtime config example returns values derived from server-side environment variables directly from an API route without warning that only explicitly safe, non-secret values should be exposed. Readers may copy this pattern and accidentally leak internal URLs, feature flags, deployment metadata, or even sensitive configuration if they broaden the response later.
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.
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.
This is a natural-language policy concern because the document uses absolute language to force particular choices regardless of user preference or project context. The rule set allows documented, justified constraints, but these lines present blanket requirements rather than optional recommendations or scoped guidance.
This markdown file applies to SQP-3, and the embedded example sets the HTML language to English explicitly. Because the file does not indicate that English is optional or justified by a region-specific requirement, it may conflict with language/locale policy expectations.
This example repeats the same locale constraint by setting the document language to English. Repeated guidance can normalize a fixed-language default without clarifying that the locale should be chosen based on user or application context.
This is another natural-language policy issue in an example string literal affecting locale handling. The example provides no indication that developers should adapt the value to their users' locale, which can encourage unnecessary English-only defaults.
No suspicious patterns detected.