Back to skill

Security audit

Prisma ORM Patterns

Security checks for vulnerabilities and agentic risk

Overview

This Prisma guidance skill is mostly coherent documentation, but it includes under-guarded database reset and test cleanup examples that could cause serious data loss if copied into the wrong environment.

Review and adapt the migration and testing snippets before installing or using this skill. Use locked local Prisma dependencies, prefer package scripts or `npx --no-install`, add explicit warnings around reset commands, and add fail-closed checks that prove test cleanup is connected only to a disposable test database.

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
references/testing-migrations.md:8
Finding

Test cleanup can destructively target a non-test database

Content
View full analysis
{ // Use a separate test database process.env.DATABASE_URL = process.env.TEST_DATABASE_URL execSync('npx prisma migrate deploy', { stdio: 'inherit' }) }) afterEach(async () => { // Clean tables in dependency order const tableNames = ['post', 'profile', 'user'] for (const table of tableNames) { await prisma.$executeRawUnsafe(`DELETE FROM "${table}"`) } }) ``` ### Technical Analysis The `PrismaClient` instance is created before `DATABASE_URL` is replaced with `TEST_DATABASE_URL`. This ordering does not reliably guarantee that the client performing cleanup is configured for the intended test database. The example also fails to verify that `TEST_DATABASE_URL`: - Is defined. - Is distinct from the production or development database URL. - Refers to an explicitly approved test host and database. - Uses credentials restricted to a disposable test schema. The cleanup operation uses `$executeRawUnsafe` to issue unrestricted table-wide `DELETE` statements. Although the table names are currently hardcoded and therefore do not directly introduce SQL injection, the unsafe API is unnecessary and makes future changes more likely to introduce injection. More importantly, the statements have no `WHERE` clause and will delete all records from the selected tables. ### Attack Path 1. A developer or CI worker starts the test suite with a production or shared database configured in `DATABASE_URL`. 2. `new PrismaClient()` is evaluated before the setup hook changes the environment variable. 3. `TEST_DATABASE_URL` is absent, incorrect, equal to the production URL, or ...[truncated 1252 chars]
Remediation
View remediation
{ await prisma.$transaction([ prisma.post.deleteMany(), prisma.profile.deleteMany(), prisma.user.deleteMany(), ]) }) ``` 5. Add a fail-closed CI guard that aborts if production indicators are present, such as a production hostname, cloud project identifier, or production database name. 6. Restrict the test database account to the isolated test database and ensure backups and recovery procedures exist for shared environments. ]]>

T08 · Insecure Dependencies

Warning
Location
SKILL.md:55
Finding

Unpinned npx commands can download and execute unexpected packages

Content
View full analysis
Remediation
View remediation
Vulnerability Patterns
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • 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 (19)

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
80% confidence
Finding

Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Content

Scanner excerpt · references/schema-design.md (reported line 24)May include surrounding context.

md
// Timestamps
  createdAt DateTime @default(now())
  updatedAt DateTime @updatedAt
  deletedAt DateTime?                           // Soft delete

  // Composite unique
  @@unique([userId, postId])

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill documents npx prisma migrate reset immediately under a generic migration workflow heading without an explicit warning that it drops and recreates the database, causing irreversible data loss if run against the wrong environment. In a developer-assistance context, users may copy commands directly, so omission of a clear caution materially increases the chance of accidental destructive execution.

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.