Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
ketanip opened this issue Jul 6, 2021 · 2 comments
Closed
Assignees
Labels
bug/2-confirmed Bug has been reproduced and confirmed. kind/bug A reported bug.
Milestone

Comments

@ketanip
Copy link

ketanip commented Jul 6, 2021

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
@janpio janpio transferred this issue from prisma/prisma Jul 6, 2021
@sdnts
Copy link
Contributor

sdnts commented Jul 9, 2021

Thanks for letting me know @ketanip, I'm able to see this as well. I'll let you know when a fix is out!

@sdnts sdnts self-assigned this Jul 9, 2021
@sdnts sdnts added bug/2-confirmed Bug has been reproduced and confirmed. kind/bug A reported bug. labels Jul 9, 2021
@sdnts sdnts added this to the 2.28.0 milestone Jul 15, 2021
@sdnts
Copy link
Contributor

sdnts commented Jul 15, 2021

Hey @ketanip, this should be fixed in the latest dev version now (npm i prisma@dev @prisma.client@dev)!

Do note that dev versions may contain unannounced breaking changes, so I wouldn't recommend using it in the long run for your app!
This will also make it to the next stable version of the Prisma CLI (Scheduled for July 27th). Let me know if this is still an issue!

@sdnts sdnts closed this as completed Jul 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug/2-confirmed Bug has been reproduced and confirmed. kind/bug A reported bug.
Projects
None yet
Development

No branches or pull requests

2 participants