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

If the Filter Rule has two diffrent data types there is a parse exception and the api is broken #15910

Open
maxmayr95 opened this issue Oct 6, 2022 · 1 comment

Comments

@maxmayr95
Copy link

Describe the Bug

I did a mistake and mapped 2 diffrent datatypes in the filter rules id of item (number) and uuid of user(string)

It should at least show the user a 403 error or even better in the backend an exception if you try to add a such rule.

Maybe check if the data type is the same.

To Reproduce

I started it locally for testing

So i did the role mapping the same.

I mapped the Id of an item (number/integer) to a user id ($CURRENT_USER) which was a string.

Now directus tries to parse the uuid of the user to a string wich results in a parse exception.

Errors Shown

atabase | 2022-10-06 22:38:29.222 UTC [145] ERROR: invalid input syntax for type integer: "NaN"
database | 2022-10-06 22:38:29.222 UTC [145] STATEMENT: select "business"."id", "business"."status" from "business" where (("business"."id" in ($1)) and ("business"."id" = $2)) order by "business"."id" asc limit $3
directus | 22:38:29 🚨 error select "business"."id", "business"."status" from "business" where (("business"."id" in ($1)) and ("business"."id" = $2)) order by "business"."id" asc limit $3 - invalid input syntax for type integer: "NaN"
directus | error: select "business"."id", "business"."status" from "business" where (("business"."id" in ($1)) and ("business"."id" = $2)) order by "business"."id" asc limit $3 - invalid input syntax for type integer: "NaN"
directus | at Parser.parseErrorMessage (/directus/node_modules/pg-protocol/dist/parser.js:287:98)
directus | at Parser.handlePacket (/directus/node_modules/pg-protocol/dist/parser.js:126:29)
directus | at Parser.parse (/directus/node_modules/pg-protocol/dist/parser.js:39:38)
directus | at Socket. (/directus/node_modules/pg-protocol/dist/index.js:11:42)
directus | at Socket.emit (node:events:513:28)
directus | at addChunk (node:internal/streams/readable:315:12)
directus | at readableAddChunk (node:internal/streams/readable:289:9)
directus | at Socket.Readable.push (node:internal/streams/readable:228:10)
directus | at TCP.onStreamRead (node:internal/stream_base_commons:190:23)
directus | 22:38:29 ✨ request errored PATCH 500 /items/business/1 31ms

What version of Directus are you using?

9.18.1

What version of Node.js are you using?

16.17.0

What database are you using?

Postgres 13

What browser are you using?

All Browser it is backend

How are you deploying Directus?

Docker and cloud

@rijkvanzanten
Copy link
Member

Linear: ENG-167

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: 📋 Backlog
Development

No branches or pull requests

3 participants