Skip to content

feat(pgsql): extend Grant kind specification with schema, tables, columns, sequences, routines, foreign data wrappers, foreign servers #235

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

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

Sabotaz
Copy link

@Sabotaz Sabotaz commented May 14, 2025

Description of your changes

Fixes #217

This PR is a rework of #218 who is still a draft and will probably be closed soon by his owner (cf. comments).

This PR create more fields in the forProvider part of the Grant kind for managing grants on different objects.

I refactored #218 by removing the defined objectType and objects fields, and using specific fields for each type of grant. I believe it follows the original philosophy of the Grant kind better.

This PR does not cover the GRANT xxx ON ALL xxx IN SCHEMA yyy case.

I have:

  • Read and followed Crossplane's contribution process.
  • Run make reviewable to ensure this PR is ready for review.

How has this code been tested

I tested this PR using both make test and make e2e.
I tested the raw queries on my local database.

e2e tests & unit tests have been updated with more Grant configurations :

  • grant some privileges on schema
  • grant some privileges on 1 table
  • grant some privileges on 1 column of 1 table
  • grant some privileges on 1 routine
  • grant some privileges on 1 sequence
  • grant some privileges on 1 foreign data wrapper
  • grant some privileges on 1 foreign server

However, I have only tested requests for multiple objets (i.e: grant all on table1, table2 to user ) on my local database.

I did not test this PR against sql injections, as I believe it is already a problem for the actual Grant feature (see #18 , #22 for mysql, and I would say #22 did not fully fix the problem for mysql as the injection can still be performed using some other fields: database, table, user).

Bastichou and others added 7 commits May 14, 2025 15:46
Signed-off-by: Bastien CERIANI <[email protected]>
Signed-off-by: Julien Christophe <[email protected]>
Signed-off-by: Julien Christophe <[email protected]>
Signed-off-by: Julien Christophe <[email protected]>
Signed-off-by: Julien Christophe <[email protected]>
Signed-off-by: Julien Christophe <[email protected]>
Signed-off-by: Julien Christophe <[email protected]>
Signed-off-by: Julien Christophe <[email protected]>
@Sabotaz Sabotaz force-pushed the feat/extend-pgsql-grant-support-to-schema branch from 31dbebe to e0f9a4b Compare May 14, 2025 19:14
@Sabotaz
Copy link
Author

Sabotaz commented May 19, 2025

@Duologic, can anyone among the maintainers review this PR?
@Bastichou as you already worked on this issue, perhaps you can review it too? :D

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

Successfully merging this pull request may close these issues.

[PGSQL] Extend Grant kind to support more than database object
2 participants