graphql-engine icon indicating copy to clipboard operation
graphql-engine copied to clipboard

Dropping inconsistent permissions due to missing columns deletes entire permissions

Open BenoitRanque opened this issue 2 years ago • 1 comments

Version Information

Server Version: 2.6.0

Environment

OSS

What is the expected behaviour?

When metadata is inconsistent due to missing column, dropping this metadata should only drop the references to the missing columns, not the whole permission metadata.

Keywords

Permissions, metadata, inconsistency, console

What is the current behaviour?

When metadata is inconsistent due to missing columns being referenced in permissions, deleting inconsistent objects should only delete the references to these columns, not the entire permissions.

How to reproduce the issue?

  1. Create and track the following table
CREATE TABLE test (id INT, name TEXT);

image

  1. Add select permissions for this table. Make sure both columns id and name are allowed for select. image

  2. Using a third party sql client (not hasura, since it won't allow inconsistencies), run this sql

ALTER TABLE test DROP COLUMN name;
  1. Reload metadata from the console. Metadata will now be inconsistent, due to the name column now being missing image image
  2. Choose to "delete all" inconsistent objects
  3. Permissions are deleted, instead of removing the reference to the name column

Hasura should instead only remove the name column from select permissions.

BenoitRanque avatar Apr 19 '22 16:04 BenoitRanque

horrible bug! please fix!

jflambert avatar May 11 '22 16:05 jflambert