hasura / hasura/graphql-engine

Permissions enforce enum types

Open
#7,708 1 comment 1 reaction 0 assignees View on GitHub
k/bug
Dominant language
TypeScript
Stars
32.1k
Forks
3k
PR merge metrics
PR metrics pending

Description

### Version Information

Server Version: 2.0.9

### Environment

Docker

### What is the expected behaviour?

Hasura should not enforce enum types when checking permissions.

### Keywords

postgres view hasura permissions Inconsistent object enum

### What is the current behaviour?

I'm using a view in order to check table permissions. The table that the view is based on has a foreign key that references an enum table. The view obviously doesn't inherit the enum metadata, so when trying to set up a permission filter that compares the view value with the enum one I get an error:

```
Inconsistent object: in table \"user_role\": in permission for role \"user\": incompatible column types: \"type\" has type \"text\", but \"type\" has type \"organization_type\"
```

### How to reproduce the issue?

1. Apply the schema & metadata from this gist https://gist.github.com/sincraianul/668fbac78f977b9dd57eda58dc8c7f89
2. Try to apply the permission JSON from the gist (`test_permission.json`)
3. Notice the error that's being thrown

### Any possible solutions?

Either make the code that evaluates permissions not enforce enum types or make views support custom metadata.

Contributor guide

Open the contributing guide

Research direction

The issue names a schema and metadata gist plus test_permission.json, but no repository files or tests. Start by applying the gist and permission JSON to reproduce the incompatible text-versus-enum error; done means the documented permission setup is accepted without that type error, or the supported limitation and required view metadata are clearly established.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, graphql, postgresql
Domain
api, authorization, database
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.