T09 · Insecure Skill Coding Practices
- Location
route-handlers.md:99- Finding
Authentication Cookie Disclosed in JSON Response Example
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This is a Next.js guidance skill with no executable payload, but several examples could lead an agent to generate insecure application code if copied as best practices.
Install only if you are prepared to treat the examples as rough Next.js notes, not secure templates. Before letting an agent apply this skill, require auth checks, runtime validation, field allowlists, secret redaction, consent/privacy review for analytics, and pinned reviewed versions for npx tools.
route-handlers.md:99Authentication Cookie Disclosed in JSON Response Example
data-patterns.md:62Server Action Examples Perform Mutations Without Authentication or Authorization
data-patterns.md:113Route Handler Passes Unvalidated Request Body Directly to ORM
async-patterns.md:86Mutable Codemod Package Is Downloaded and Executed Through npx
self-hosting.md:314OpenNext and SST Tooling Is Executed Without Exact Version Pinning
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 documentation instructs users to run npx @next/codemod@latest ..., which fetches and executes remote package code without pinning a specific version. If the upstream package is compromised or a malicious release is published, users following this guidance could execute attacker-controlled code on their machine or in CI.
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>
This markdown file instructs users to call a local MCP endpoint and highlights tools such as get_project_metadata and get_logs, which return the project path, dev server URL, and log file location. The description does not warn that these responses may reveal sensitive local system or project information during debugging.
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
The endpoint uses JSON-RPC 2.0 over HTTP POST:
curl -X POST http://localhost:<port>/_next/mcp \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{
The documentation instructs users to run npx @next/codemod@latest upgrade, which fetches and executes the latest published package version at runtime rather than a reviewed, pinned version. If the package or one of its resolution paths were compromised, users following this guidance could execute unintended code on their local machine or CI environment.
The example reads a token from cookies and includes it in a JSON response, which teaches a pattern that exposes sensitive authentication material back to the client. In documentation for Next.js route handlers, readers may copy this directly into production code, increasing the chance of token leakage through browser-visible responses, logs, caches, or client-side script access.
Echoing a cookie-derived token back to the client defeats the usual purpose of keeping such credentials confined to secure cookie storage, and can make the token accessible in application responses and downstream telemetry. As a best-practices skill, this is more dangerous because it presents the behavior as a normal request-helper pattern rather than explicitly warning against exposing secrets.
This markdown file instructs users to add Google Analytics and Google Tag Manager integrations, which send visitor and system interaction data to third parties. The section provides implementation guidance but does not mention any privacy, consent, or data-sharing implications, which is a missing warning for behavior that can affect user data and privacy.
The example recommends exposing runtime configuration through a public API endpoint and returns environment-derived values without any warning, allowlist guidance, or authentication. This pattern can easily lead developers to leak sensitive operational details or mistakenly expose secrets if they copy the example and include unsafe variables.
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.
The markdown includes a deletion mutation example that removes a post directly with db.post.delete, but the surrounding documentation does not mention confirmation, reversibility, or user impact. For markdown files, this qualifies as an omitted warning about behavior that could affect user data.
The example sets <html lang="en">, which forces an English locale in the provided pattern. Because the document does not mention this as an example-only placeholder, offer alternatives, or justify an English-only constraint, it can conflict with language/locale policy expectations.
This sample again uses <html lang="en"> as a fixed locale. Repeating the pattern without caveat can encourage implementers to ship English-only markup even when their application serves other languages.
The third layout example uses lang="en" with no surrounding guidance about localization. Across multiple examples, this presents an implicit English-only default rather than offering a user or app-specific locale choice.
No suspicious patterns detected.