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

Crash when reading PG table where user has no SELECT permissions #126

Open
KillerX opened this issue Sep 5, 2022 · 1 comment
Open

Crash when reading PG table where user has no SELECT permissions #126

KillerX opened this issue Sep 5, 2022 · 1 comment

Comments

@KillerX
Copy link

KillerX commented Sep 5, 2022

It appears that if there is a table in the schema for which the connected user does not have at least SELECT permissions, the following error occurs:

TypeError: Cannot set properties of undefined (setting 'primary')
    at Postgres.<anonymous> (node_modules/@directus/schema/dist/dialects/postgres.js:128:58)
    at step (node_modules/@directus/schema/dist/dialects/postgres.js:67:23)
    at Object.next (cms/node_modules/@directus/schema/dist/dialects/postgres.js:48:53)
    at fulfilled (node_modules/@directus/schema/dist/dialects/postgres.js:39:58)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)

I'm not sure what the correct response in this situation is. For my use case it would be enough to just ignore the table, but I am not sure if that is the correct response for other use cases where you might want the information that the table exists but you do not have access to it.
Either way at least a clear error message as to what is going on would go a long way, since now it is very unclear why the system crashes.

@rijkvanzanten
Copy link
Collaborator

I believe your particular issue is thrown in Directus rather than this package, but the same symptom will also appear here regardless. Currently the package assumes that you have full permissions to the database in order to do the introspection

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants