Back to skill

Security audit

Prisma

Security checks for vulnerabilities and agentic risk

Overview

This Prisma skill is a coherent documentation skill with expected database-development guidance, but users should be careful around persistent preferences, unpinned npx examples, logging query parameters, and destructive test-database commands.

Install only if you are comfortable with a Prisma helper that may read and maintain a small preference/memory file under ~/Clawic/data/prisma/. Before running examples, verify Prisma is installed from your project's lockfile, confirm any DATABASE_URL or TEST_URL points at the intended environment, avoid --force-reset outside disposable test databases, and do not log raw query parameters in production without redaction.

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

Warning
Location
performance.md:7
Finding

Raw Prisma Query Parameters May Be Disclosed Through Application Logs

Content
View full analysis

Vulnerability Details

File Location: performance.md:7-13
Vulnerability Type: Sensitive data exposure through unsafe query logging
Risk Level: Medium

ts
const prisma = new PrismaClient({
  log: [{ emit: 'event', level: 'query' }],
})
prisma.$on('query', (e) => {
  if (e.duration > 50) console.warn(e.duration, e.query, e.params)
})

Technical Analysis

The example logs e.params, which contains the bound values supplied to the database query. Depending on the application, these values may include credentials, authentication tokens, password hashes, email addresses, session identifiers, financial information, or other personally identifiable information.

Restricting the log to queries taking more than 50 milliseconds reduces log volume but does not sanitize the values. In production environments, standard output and standard error are commonly collected and transmitted to centralized logging or observability services. Consequently, this example can create an unintended network disclosure path and expand access to sensitive database values beyond the application and database.

This behavior exceeds the minimum information needed for routine performance monitoring. Query duration, operation name, model, row count, and a normalized query fingerprint are normally sufficient without recording raw parameter values.

Attack Path

  1. An application adopts the documented query-logging example.
  2. An attacker or ordinary user submits sensitive input that becomes a Prisma query parameter.
  3. The corresponding query takes more than 50 milliseconds.
  4. The callback writes the SQL and raw e.params value to console.warn.
  5. The deployment platform forwards console output to a local or third-party log aggregation service.
  6. An attacker with compromised log access, or an internal user with broader log permissions than database permissions, retrieves the sensitive value.

Impact Assessment

...[truncated 481 chars]

Remediation
View remediation

Remediation Suggestions

  • Remove e.params from the default logging example.
  • Log only non-sensitive metadata such as duration, operation, model, and a normalized query fingerprint.
  • Require explicit, temporary opt-in before enabling parameter logging.
  • Restrict any parameter-level debugging to local or isolated non-production environments.
  • If values must be recorded, apply structured redaction for passwords, tokens, cookies, authorization values, personal data, and application-defined sensitive fields.
  • Configure strict access controls, encryption, short retention, and audit trails for centralized logs.
  • Add a warning that Prisma query events can contain sensitive SQL parameters.

A safer default is:

ts
prisma.$on('query', (e) => {
  if (e.duration > 50) {
    console.warn({
      durationMs: e.duration,
      queryFingerprint: fingerprint(e.query),
    })
  }
})

T08 · Insecure Dependencies

Note
Location
SKILL.md:38
Finding

Unpinned npx Commands May Execute an Unverified Prisma Package

Content
View full analysis

Vulnerability Details

File Location: SKILL.md:38-41
Vulnerability Type: Unverified third-party package execution
Risk Level: Low

markdown
| Situation | Play |
|---|---|
| Schema edited, database unchanged | Dev: `npx prisma migrate dev`; prod/CI: `migrate deploy`; throwaway prototype only: `db push` (→ Core Rules 1) |
| "Unknown argument" or a model missing on the client | Client is stale generated code — `npx prisma generate` (→ Core Rules 2) |

Similar unpinned commands also appear in deployment.md, migrations.md, and testing.md.

Technical Analysis

The Skill repeatedly recommends executing npx prisma without first requiring verification that Prisma is declared in the project, resolved from a lockfile, and installed locally. When no local binary is available, npx can offer to retrieve and execute a package from the configured package registry. The resulting code is executed with the privileges of the invoking user.

The commands also trust project-local command resolution. If the agent operates in an untrusted or compromised repository, a malicious local package or binary presented as Prisma could be selected. The Skill does not instruct the agent to verify the package source, installed version, lockfile integrity, or command resolution before execution.

The legitimate Prisma CLI needs database and filesystem access for generation and migration tasks, but implicit acquisition of an unspecified package version is not necessary for that functionality.

Attack Path

  1. An agent follows the Skill inside an untrusted or compromised project.
  2. The project either lacks a trusted local Prisma installation or supplies a manipulated local package or binary.
  3. The agent executes an instructed command such as npx prisma generate or npx prisma migrate dev.
  4. npx resolves the manipulated local executable or offers to retrieve an unspecified registry version.
  5. Package installation ...[truncated 1020 chars]
Remediation
View remediation

Remediation Suggestions

  • Verify that prisma is declared in the project's dependencies or development dependencies before execution.
  • Require a committed lockfile and use the project's locked package-manager workflow.
  • Prefer a package script backed by the locked dependency, such as npm run prisma -- generate.
  • Where supported, use npx --no-install prisma ... to prevent implicit package retrieval.
  • Resolve and inspect the executable path before running commands in an untrusted repository.
  • Require explicit user confirmation before installing Prisma or changing its version.
  • Pin approved Prisma versions and review lockfile changes in CI.
  • Run migration commands with a least-privileged database identity and avoid exposing production credentials during package installation.
  • Document that command execution should stop if the expected local Prisma binary is unavailable.
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (31)

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
| Query the schema cannot express (CTE, window, DISTINCT ON, upsert-heavy batch) | `$queryRaw` tagged template, or TypedSQL for typed results (→ `raw-sql.md`) |

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
| Query the schema cannot express (CTE, window, DISTINCT ON, upsert-heavy batch) | `$queryRaw` tagged template, or TypedSQL for typed results (→ `raw-sql.md`) |

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
| Query the schema cannot express (CTE, window, DISTINCT ON, upsert-heavy batch) | `$queryRaw` tagged template, or TypedSQL for typed results (→ `raw-sql.md`) |

Hidden Instructions

High
Category
Prompt Injection
Confidence
70% confidence
Finding

Hidden instructions were detected in comments or invisible text. These could contain malicious directives. Manual review is recommended.

Content

Scanner excerpt · memory-template.md (reported line 13)May include surrounding context.

md
last: YYYY-MM-DD

## Context
<!-- Provider and version, hosting target, pooler -->
<!-- Schema scale: models, largest tables, multi-tenancy shape -->
<!-- Migration workflow and who applies migrations -->

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The manifest states the skill is 'Not for ... hand-written SQL (pg, sql)', which sets a clear scope boundary. This file is entirely dedicated to teaching when and how to use raw SQL in Prisma, including $queryRaw, $executeRaw, bulk upserts, DDL, and TypedSQL, which goes beyond merely incidental mention and directly conflicts with the stated scope.

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.

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.

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.

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.

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.

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.

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.

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.

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.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The setup instructions direct the agent to read and update user-scoped files under ~/Clawic/data/prisma/ automatically, including memory and configuration, without requiring explicit user awareness or consent at the time of access. This creates a privacy and integrity risk: the skill can silently persist user attributes, project context, and preferences across sessions, and later behavior may be influenced by stale or sensitive stored data the user did not intend to share or retain.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The command includes prisma db push --force-reset, which will drop and recreate data at the database pointed to by DATABASE_URL. In a Prisma testing skill, destructive reset commands are contextually relevant, but presenting one without an immediate, explicit warning increases the risk of a user pasting it against the wrong environment and causing irreversible data loss.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.