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

Declarative management for PostgreSQL roles #46

Open
davenquinn opened this issue Mar 29, 2024 · 3 comments
Open

Declarative management for PostgreSQL roles #46

davenquinn opened this issue Mar 29, 2024 · 3 comments
Assignees

Comments

@davenquinn
Copy link
Member

We're increasingly encoding access control in PostgreSQL roles. This is great, but means we need to have good ways to manage/apply these roles on database startup and changes (e.g., migrations).

Here's an example of some role configuration for PostgREST: https://github.com/UW-Macrostrat/macrostrat/blob/main/cli/macrostrat/cli/subsystems/knowledge_graph/fixtures/roles.sql

We need to figure out how to centralize and generalize this, in tandem with defining finer-grained roles and potentially row-level security for data access management.

Context:

@davenquinn
Copy link
Member Author

@brianaydemir we can worry more about this later, but this is a lane in which I feel there must be some existing software solution? Keeping a set of roles consistent seems like a really general problem for postgres-based systems...

@davenquinn
Copy link
Member Author

davenquinn commented Sep 16, 2024

@amyfromandi just making you aware of this issue, as we need to get better at managing roles in Macrostrat in order to use PostgreSQL "row-level-security" in conjunction with PostgREST.

We could use a pre-existing library for this... sqlauthz seems like it could work. A few points

  • The library has a silly name
  • It is written in Typescript, which would be slightly harder to integrate with our command-line application (though not impossible – we could use Docker!)
  • It uses the "polar" domain-specific language, which could be good or bad (pros: less yaml; cons: another language).

Overall, this might be worth taking a deeper look at as we start on the v3 API design.

@davenquinn
Copy link
Member Author

We've created a start to GRANT functionality in the Macrostrat CLI in #97. We'll see if this is adequate. Currently, it doesn't check the current state or remove grants in excess of requirements. But these capabilities could be added.

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