Skip to content

Prisma Studio fails to add or update record in database when it contains ". #722

@ketanip

Description

@ketanip

Bug description

This is a bug in Prisma Studio . When " in present as a value in String field , Prisma studio fails to handle it and " acts in a similar manner to how it acts in a SQL Injection and the query fails. This issue as per my knowledge only exists in Prisma Studio.

How to reproduce

  1. Create any kind of model in Prisma schema file with String field.
  2. Open the model in Prisma Studio and try to add or update the field of type String with an " in it.
  3. It Shows an error as shown in Prisma information section of this bug report.

Expected behavior

No response

Prisma information

Schema

model User {
  id                      Int         @id @default(autoincrement())
  name                String
  picture             String?
  email               String     @unique
  password        String?
  email_verified Boolean  @default(false)
}

Error

Type: undefined
Message: Invalid or unexpected token

Code: undefined

Query:
prisma.user.update(
{
  where: {
    id: 1,
  },
  data: {
    name: "Jhon Doe"",
  },
  select: {
    id: true,
    name: true,
  },
}
)

Environment & setup

  • OS: Windows
  • Database: PostgreSQL
  • Node.js version: v14.16.0

Prisma Version

 2.25.0

Metadata

Metadata

Assignees

Labels

bug/2-confirmedBug has been reproduced and confirmed.kind/bugA reported bug.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions