Skip to content
Report library
Purpose / Data analysis

Prisma Client API Skill Security Audit

What the author says it does (original text)

Prisma Client API reference covering model queries, filters, operators, and client methods. Use when writing database queries, using CRUD operations, filtering data, or configuring Prisma Client. Triggers on "prisma query", "findMany", "create", "update", "delete", "$transaction".

Independent security check

Security risks found

Files checked
9
Risks found
3
Could it run dangerous commands?Looks for programs run straight after downloading, remote control of your computer, and hidden commands.Risks found: 1
Medium risk

Dynamic identifiers and Unsafe APIs can execute injected SQL when input boundaries are wrong

Source references: 3
What we found

The reference demonstrates Prisma.raw(column) and $queryRawUnsafe. It does warn that the former is unsafe for user input and labels the latter an injection risk, but these APIs do not safely escape dynamic SQL structure. If an agent feeds request data into a table name, column name, or concatenated statement, the database can execute it as SQL.

Why this matters

An attacker could read, modify, or delete any data accessible to the database account.

Legitimate use of this code

The cited injection mechanism is possible if these APIs are misused, but the source does not direct users to pass untrusted input. The identifier example uses a constant and explicitly says user input is unsafe; the Unsafe example says to use trusted input only, and the later concatenation sample is clearly labeled a vulnerability alongside a parameterized form. This is safety guidance and a negative example, not encouragement to execute injected SQL. Users can still require generated code to keep request values out of `Prisma.raw()` and favor parameterized templates.

This assessment concerns the code and conditions shown, not proof that harm has occurred.
references/raw-queries.md:25In the instructionsOpen original file
### Dynamic table/column namesUse `Prisma.raw()` for identifiers (not safe for user input):```typescriptimport { Prisma } from '../generated/client'const column = 'email'const users = await prisma.$queryRaw`  SELECT ${Prisma.raw(column)} FROM "User"````
Show 2 other places
references/raw-queries.md:94In the instructionsOpen original file
## $queryRawUnsafe / $executeRawUnsafeFor fully dynamic queries (use with caution!):```typescript// ⚠️ SQL injection risk - only use with trusted inputconst table = 'User'const users = await prisma.$queryRawUnsafe(  `SELECT * FROM "${table}" WHERE id = $1`,  userId)```
references/raw-queries.md:117In the instructionsOpen original file
## SQL Injection Prevention### Safe (parameterized)```typescript// ✅ User input is parameterizedconst email = userInputconst users = await prisma.$queryRaw`  SELECT * FROM "User" WHERE email = ${email}````### Unsafe (concatenation)```typescript// ❌ SQL injection vulnerability!const email = userInputconst users = await prisma.$queryRawUnsafe(  `SELECT * FROM "User" WHERE email = '${email}'`)```
Could it expose your files or keys?Looks for uploads of files containing passwords or keys, and keys written directly in the code.Risks found: 2
Medium risk

The query-event example writes all query parameters to console logs

Source references: 1
What we found

After enabling query events, the example logs e.params. Depending on the application query, these values can contain emails, tokens, passwords, or other personal data; console output is often collected by logging services or included in shared diagnostics.

Why this matters

Sensitive database inputs could be copied into logs with broader access and longer retention than the database itself.

This is an optional documentation example and does not run merely because the Skill is installed. However, it explicitly enables query events and writes `e.params` to the console. If adopted in a real application, query parameters could enter centralized logs or diagnostic bundles; the exposed data depends on actual queries. Users can ask for redaction guidance or prohibit parameter logging in production.

references/client-methods.md:71In the instructionsOpen original file
```typescriptconst prisma = new PrismaClient({  adapter,  log: [{ level: 'query', emit: 'event' }]})prisma.$on('query', (e) => {  console.log('Query:', e.query)  console.log('Params:', e.params)  console.log('Duration:', e.duration, 'ms')})```
Medium risk

The reference includes an unfiltered whole-table deletion example

Source references: 1
What we found

The deleteMany({}) example explicitly deletes every user record. Although presented in deletion documentation, copying it into a real database—or treating an empty filter as a safe default—would cause broad, persistent data loss.

Why this matters

It can empty an entire table; recovery depends on backups, point-in-time recovery, and transaction boundaries.

This is a CRUD reference example, not code that runs automatically. Still, `deleteMany({})` is explicitly presented as deleting all records. If an agent copies and runs it against a connected production database, every user row could be permanently removed. Users can require confirmation of the target database, backups, and a nonempty filter, and forbid full-table deletion without explicit authorization.

references/model-queries.md:214In the instructionsOpen original file
### deleteManyDelete multiple records:```typescriptconst result = await prisma.user.deleteMany({  where: { role: 'GUEST' }})// Returns { count: 5 }// Delete allconst result = await prisma.user.deleteMany({})```
Could it delete files or keep running?Looks for broad file deletion, disk overwrites, and programs set to start automatically.No risks found
Could it bypass safety checks?Looks for skipped website security checks, excessive file access, or actions that skip your approval.No risks found
Could it mislead the AI or hide text?Checks the skill instructions for requests to ignore you, influence the report, or hide text in invisible characters.No risks found
Could it change links or payment recipients without asking?Looks for forced referral or payment changes combined with instructions to hide the change.No risks found

Inside this skill

8 instruction sections

This Skill is a Prisma Client reference covering database connections, CRUD, filtering, relations, transactions, and raw SQL; its main file directs the agent to open the matching reference by category.

View source
SKILL.md:168In the instructionsOpen original file
## Rule FilesDetailed API documentation:```references/constructor.md        - PrismaClient constructor optionsreferences/model-queries.md      - CRUD operationsreferences/query-options.md      - select, include, omit, where, orderByreferences/filters.md            - Filter conditions and operatorsreferences/relations.md          - Relation queries and nested operationsreferences/transactions.md       - Transaction APIreferences/raw-queries.md        - $queryRaw, $executeRawreferences/client-methods.md     - $connect, $disconnect, $on, $extends```
SKILL.md:214In the instructionsOpen original file
## How to UsePick the category from the table above, then open the matching reference file for implementation details and examples.

The connection examples read credentials from the DATABASE_URL environment variable and construct a PostgreSQL adapter; actual queries would run with whatever database privileges that connection string grants.

View source
references/constructor.md:7In the instructionsOpen original file
```typescriptimport { PrismaClient } from '../generated/client'import { PrismaPg } from '@prisma/adapter-pg'const adapter = new PrismaPg({  connectionString: process.env.DATABASE_URL})const prisma = new PrismaClient({ adapter })```

The material includes parameterized raw-SQL examples and explicitly labels string concatenation as SQL injection; the provided lines do not instruct the agent to bypass that warning, upload data, or install/run bundled scripts.

View source
references/raw-queries.md:117In the instructionsOpen original file
## SQL Injection Prevention### Safe (parameterized)```typescript// ✅ User input is parameterizedconst email = userInputconst users = await prisma.$queryRaw`  SELECT * FROM "User" WHERE email = ${email}````### Unsafe (concatenation)```typescript// ❌ SQL injection vulnerability!const email = userInputconst users = await prisma.$queryRawUnsafe(  `SELECT * FROM "User" WHERE email = '${email}'`)```
Start here · InstructionsSKILL.md
prisma-client-api
Lines connect the instruction file to its sections, not an observed execution order. Select a section to read the source. 5 more sections are available in the original file.

File reference map

References: 8
Files making referencesReferenced content
Lines show actual file references, not execution order. Select a node to highlight its connections and inspect the files and source locations. Dashed lines include files that still need locating.
Files and check records9 files

Coverage and gaps

Content covered in each file

These are the source ranges included in this check, not a guarantee that every issue has been resolved.

  • SKILL.mdFull text included
  • references/client-methods.mdFull text included
  • references/constructor.mdFull text included
  • references/filters.mdFull text included
  • references/model-queries.mdFull text included
  • references/query-options.mdFull text included
  • references/raw-queries.mdFull text included
  • references/relations.mdFull text included
  • references/transactions.mdFull text included

This report is for the version above. We read the available code and instructions without running the skill or checking extra packages it installs. This is not a promise of safety: a different version or setup may behave differently.

  • SKILL.mdInstructions
  • references/client-methods.mdSupporting file
  • references/constructor.mdSupporting file
  • references/filters.mdSupporting file
  • references/model-queries.mdSupporting file
  • references/query-options.mdSupporting file
  • references/raw-queries.mdSupporting file
  • references/relations.mdSupporting file
  • references/transactions.mdSupporting file

Operations mentioned in code and instructions

Read keys or account settings
SKILL.md:55In the instructionsOpen original file
const adapter = new PrismaPg({  connectionString: process.env.DATABASE_URL})
references/constructor.md:12In the instructionsOpen original file
const adapter = new PrismaPg({  connectionString: process.env.DATABASE_URL})
references/constructor.md:28In the instructionsOpen original file
const adapter = new PrismaPg({  connectionString: process.env.DATABASE_URL})
Connect to websites
SKILL.md:210In the instructionsOpen original file
- [Prisma Client API Reference](https://www.prisma.io/docs/orm/reference/prisma-client-reference)- [CRUD Operations](https://www.prisma.io/docs/orm/prisma-client/queries/crud)
SKILL.md:211In the instructionsOpen original file
- [Prisma Client API Reference](https://www.prisma.io/docs/orm/reference/prisma-client-reference)- [CRUD Operations](https://www.prisma.io/docs/orm/prisma-client/queries/crud)- [Filtering and Sorting](https://www.prisma.io/docs/orm/prisma-client/queries/filtering-and-sorting)
SKILL.md:212In the instructionsOpen original file
- [CRUD Operations](https://www.prisma.io/docs/orm/prisma-client/queries/crud)- [Filtering and Sorting](https://www.prisma.io/docs/orm/prisma-client/queries/filtering-and-sorting)
Lines read
2,172
File checksum (to compare versions)
9e1cfcbec3f8e131c6eb173561f59ff6f1afaa2041028c24d58bc942a9bed338