Back to skill

Security audit

neon-functions

Security checks for vulnerabilities and agentic risk

Overview

ClawScan marked this skill suspicious because it found a potentially exposed data-count example and several behaviors that do not clearly match the stated Neon-functions purpose; analysis was partial.

Consider the suspicious verdict before installing. Review the flagged examples, especially the unfiltered todos count and the unpinned setup command. Coverage was partial: 4 of 9 components were fully inspected, and several references had analysis limits, so the scan cannot establish that the remaining content is safe.

Vulnerability Patterns
  • 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
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Output HandlingUnvalidated Output Injection, Cross-Context Output, Unbounded Output
Findings (22)

Description-Behavior Mismatch

High
Category
MCP Tool Poisoning
Confidence
94% confidence
Finding

Although both involve application deployment, the supplied command targets a different platform and resource model. It shows no Neon function deployment, database-branch association, or DATABASE_URL injection. Nothing in the chunk establishes that the Mastra deployment is a supporting step for the declared Neon workflow.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
MCP Tool Poisoning
Confidence
94% confidence
Finding

The supplied chunk's primary behavior is maintaining a client connection to an existing WebSocket service. It does not implement an HTTP function, accept incoming WebSocket connections, deploy to Neon, or handle function triggers. While a WebSocket client could support a larger server application, no such relationship is shown here; the supplied behavior is materially different from the declared hosting purpose.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
MCP Tool Poisoning
Confidence
92% confidence
Finding

The supplied commands manage Mastra authentication rather than Neon functions or triggers. Neither the description nor the supplied chunk establishes Mastra account access as a supporting requirement for the declared functionality. This assessment is limited to the provided commands; they do not demonstrate credential exfiltration or deployment behavior.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
MCP Tool Poisoning
Confidence
90% confidence
Finding

The supplied chunk only invokes a skills-related CLI command. It contains no function deployment, request handling, trigger configuration, or other behavior supporting the declared purpose. Although skill setup could be a prerequisite in a larger workflow, that workflow is not present in the supplied code. The command's downstream effects cannot be determined without its implementation.

Content

No source excerpt is available for this finding.

Incomplete referenced artifact analysis

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

Scanner excerpt · SKILL.md (reported line 308)May include surrounding context.

md
ling next to Postgres, and persisting generated images to Object Storage), see [references/ai-sdk.md](https://neon.com/docs/ai/skills/neon-functions/references/

Incomplete referenced artifact analysis

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

Scanner excerpt · SKILL.md (reported line 652)May include surrounding context.

md
icate with a `?token=` query param or cookie, exactly like the WebSocket case. [references/sse.md](https://neon.com/docs/ai/skills/neon-functions/references/sse

Incomplete referenced artifact analysis

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

Scanner excerpt · SKILL.md (reported line 689)May include surrounding context.

md
all can hit a client's 30-second connection timeout. The fallback wiring is in [references/mcp.md](https://neon.com/docs/ai/skills/neon-functions/references/mcp

Incomplete referenced artifact analysis

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

Scanner excerpt · SKILL.md (reported line 691)May include surrounding context.

md
ion: [references/production-hardening.md](references/production-hardening.md). [references/mcp.md](https://neon.com/docs/ai/skills/neon-functions/references/mcp

Incomplete referenced artifact analysis

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

Scanner excerpt · SKILL.md (reported line 707)May include surrounding context.

md
t's own caught/fallback failures (the long-running case Functions target): see [references/sentry.md](https://neon.com/docs/ai/skills/neon-functions/references/

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · references/mastra-studio.md (reported line 79)May include surrounding context.

mastra auth whoami # shows your user + org id (org_…)

text

- **Access token (non-interactive):** `mastra auth tokens create <name>` prints a one-time secret (`sk_…`). This is your `MASTRA_PLATFORM_ACCESS_TOKEN`.
- **Project:** the interactive `mastra studio projects create` TUI is hard to script. Instead, register the project as part of a Studio deploy, which is non-interactive with `-y` and writes the project id to `.mastra-project.json`:

```bash

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · references/mcp.md (reported line 125)May include surrounding context.

md
> [!WARNING]
> A Neon Function has a **public HTTPS URL — anyone can reach it.** An unauthenticated MCP server hands every caller your tools (and the database behind them). Authenticate at the top of the handler before touching the transport, exactly as for [any client-facing function](../SKILL.md#functions-as-an-agent-backend-nextjs-and-similar-frameworks).

Use **Managed Better Auth (Neon Auth) as the OAuth server** and guard the Function with `@neon/oauth` (0.3.0 or later). MCP clients that support OAuth (Cursor, Claude, ChatGPT) discover the server, sign the user in on a login and consent page you host, and call `/mcp` with an access token. Keep the app's existing login; the OAuth server sits beside it. The full path (CLI setup, clients, pages, verification) is [neon-auth references/oauth-server.md](https://neon.com/docs/ai/skills/neon-auth/references/oauth-server.md).

### Option 1 — OAuth via Managed Better Auth (best for third-party clients)

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · references/native-binaries.md (reported line 82)May include surrounding context.

text

```bash
npm run build:fn && neon deploy --env .env.local
neon functions deploy api --src dist/fn --no-bundle   # same thing, without neon.ts

Skill Enumeration

Medium
Category
Agent Snooping
Confidence
80% confidence
Finding

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.

Content

Scanner excerpt · SKILL.md (reported line 25)May include surrounding context.

FIRST: Use the parent neon skill for a Neon overview, getting started with Neon, Neon development best practices, and more.

If the neon skill is not installed, fetch it from https://neon.com/docs/ai/skills/neon/SKILL.md or install it with:

bash
neon skills -s neon -y

Whitespace Padding

Medium
Category
Prompt Injection
Confidence
70% confidence
Finding

Large whitespace padding was detected (a block of blank lines or a long run of spaces). This can push injected instructions below or to the right of the visible area so a human reviewer never sees them while the agent still reads them. Manual review of the hidden content is recommended.

Content

Scanner excerpt · SKILL.md (reported line 196)May include surrounding context.

md
|
| --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `NEON_BRANCH`               | The branch **name** (e.g. `main`, `preview/foo`). Injected on every branch, including the default.                                                                 |
| `NEON_BRANCH_ID`            | The branch **id** (`br-...`). Injected on every branch.                                                                                                              |
| `NEON_FUNCTION_HOST_SUFFIX` | The hostname suffix every function on the branch shares (`.compute.c-2.us-east-2.aws.neon.tech`). See [How to get the function URL](#how-to-get-the-function-url). |
| `DATABASE_URL`              | Pooled connection string. Use for most queries. Present only if the branch has Postgres.

The agent forwards chat messages and database-derived tool results to external model providers without a privacy warning.

Medium
Category
Output Handling
Confidence
89% confidence
Finding

The example passes incoming chat messages to a gateway-backed model and makes todo counts available to its tool loop. Although provider routing is described, the document does not warn that conversation content and database-derived results are transmitted to external model providers.

Content

No source excerpt is available for this finding.

The tool claims to count the user's open todos but counts every row in the todos table.

Medium
Category
Excessive Agency
Confidence
98% confidence
Finding

The tool executes an unfiltered count of the todos table despite promising the current user's open todos. In a multi-user deployment without independently enforced row isolation, a caller can obtain aggregate information about other users' records; the missing open-status predicate also makes the result incorrect.

Content

No source excerpt is available for this finding.

The deployment example creates a public-read bucket without warning about data exposure.

Medium
Category
Output Handling
Confidence
90% confidence
Finding

The configuration sets the assets bucket to access: "public_read", and the accompanying workflow instructs running neon deploy. There is no warning that objects placed in this bucket will be publicly readable, which could expose private uploads if the example is adopted unchanged.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
60% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · references/function-triggers.md (reported line 224)May include surrounding context.

neon dev forwards x-neon-trigger-invocation-id, so you can simulate a tick:

bash
curl -X POST http://localhost:8787/cron \
  -H 'content-type: application/json' \
  -H 'x-neon-trigger-invocation-id: local-dev' \
  -d '{

MCP server referenced without pinned version: 'npx add-mcp'.

Medium
Category
MCP Rug Pull
Confidence
84% confidence
Finding

The unversioned npx add-mcp command can download and execute a changing npm release with the developer's local permissions. A compromised release could access local credentials or modify agent configuration; this is a supply-chain exposure in the setup CLI, rather than an unpinned MCP server itself.

Content

No source excerpt is available for this finding.

Autonomous Decision Making

Medium
Category
Excessive Agency
Confidence
75% confidence
Finding

Skill enables autonomous high-impact decisions without human-in-the-loop verification. Critical operations (destructive commands, financial transactions, data deletion) should require explicit user confirmation.

Content

Scanner excerpt · references/production-hardening.md (reported line 17)May include surrounding context.

md
--------------------------------------- |
| Trusted app server (Vercel/Netlify route, server action, queue worker) that finishes within that host's duration | The server calls the Function. Browser never sees the Function URL or the origin secret. Function returns 401 before any work.                                                                                                                    | Put the secret in client code. Proxy a long agent, WebSocket, or SSE stream through the app host without checking that host's duration. |
| Function Triggers only                                                                                           | `parseTriggerDelivery` (both types). Keep this path outside JWT and `X-Secret` middleware.                                                                                                                                                        | Require a user JWT or `X-Secret` on the trigger path. Invent `x-neon-invocation-id`. Treat `invoca

The Upstash quota example sends authenticated principal identifiers to a third-party service without a privacy warning.

Medium
Category
Output Handling
Confidence
91% confidence
Finding

The example passes authenticatedPrincipalId directly to the Upstash-backed limiter, transmitting the identifier to an external service. Although the document names Upstash and explains its configuration, it does not warn that user or organization identifiers are disclosed to that service.

Content

No source excerpt is available for this finding.

Query-string authentication is recommended without warning that URLs can expose credentials in logs.

Medium
Category
Output Handling
Confidence
96% confidence
Finding

The guidance recommends placing a JWT in the SSE URL without addressing credential exposure through request logs, proxy telemetry, or monitoring systems. If a reusable bearer token is captured there, someone with access to those records can replay it; verifying its signature before streaming does not prevent this disclosure.

Content

No source excerpt is available for this finding.