-
Notifications
You must be signed in to change notification settings - Fork 81
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
base: master
Are you sure you want to change the base?
Conversation
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]>
e40c724
to
31dbebe
Compare
Signed-off-by: Julien Christophe <[email protected]>
31dbebe
to
e0f9a4b
Compare
@Duologic, can anyone among the maintainers review this PR? |
Adding @chlunde to the loop - this change is really needed by many Postgres users |
Just tested and I can confirmed that I can achieve
Looking forward to use official provider not custom build. |
@dawidmalina thanks for testing! If we have consensus on the schema design, I think that (and testing) is most important. Linewise, the change is huge (+2000 lines), so getting a few eyes on this would be very helpful. |
Any updates on this? I would really like to see that to be part of the official release. |
@Bastichou could you take a look at this version? I've read through all the issues and closed duplicates, and I think this solves a lot of them. I'd like to make this part of the next release, so thanks a lot for everyone working on this! Two things I would like to test:
@Sabotaz do you think this could be handled in the future, could you expand a bit on this? Thanks! |
Can you elaborate what design you mean? The CRD design? Code design? |
FWIW: I've tested the implementation and so far seems to be doing what it should. |
An example :
if someone create a table_3, we have to add table_3 in this list. Some users would like to directly grant privileges on all tables, something like :
The thing is, in the same way the "ALL" privileges is expanded on the real privileges list, we would need to expand the table list by listing all the tables on the schema every time this resource is reconciled, because if a new table is created, grants are not given by default, and the "ALL" on the past is not always the same as the "ALL" of the future. Another technique is to just count the correct grants and assert it's the same length as the tables count, so no expand is needed. This issue could also be addressed by resolving #117 (default privileges). About if it can be handled in the future, yes probably. The SQL requests are already quite obscure, but if someone love SQL, it should be easy. I don't like the |
I think the CRD design. The initial PR #218 had another design :
But it had 2 drawbacks :
For some values of These problems does not exist with the proposed CRD. Another good point with this design is that for tables, the spec is the same as the MySQL Grant kind, so I think having one field for each kind of objects is more in the initial philosophy of the Grant CRD.
|
Are we going in direction where this change can be accepted and merged? |
Adding @ulrich-giraud who added capability to grant on all sequences and tables https://github.com/Evaneos/provider-sql maybe we could join forces under one project. |
I was waiting for this change to be accepted and avoid adding another layer of complexity (and it also needs a little bit more work ).
I played with the idea of a boolean property |
I wonder if there is still something missing in this PR before it can be merged? I think we all agree and there have been some tests done to prove it is correct. I am pretty sure that the current shape is good enough to start with and all other enhancements like |
My two cents: In most workflows, tables, sequences, functions, etc. are created by Flyway or Liquibase, so you can’t know their names up front. It would be great to have an ALL option like Hope this makes sense! |
Hi @Sabotaz would it be possible to include altering the default permissions as well? i.e: |
this is very useful change. waiting for this to approve and merge. are we publishing any pre-release version which i can test and give feedback? |
What is that status of this? This would be extremely useful for us as well. |
+1 for this being a feature that would be very useful. |
Hello fnicolelli-ls :) |
Hi @chlunde :) any update on this topic? Is there anything we can do to move this forward? |
1e82e38
to
7fe2075
Compare
7fe2075
to
a2ecd7e
Compare
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
andobjects
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:
make reviewable
to ensure this PR is ready for review.How has this code been tested
I tested this PR using both
make test
andmake e2e
.I tested the raw queries on my local database.
e2e tests & unit tests have been updated with more Grant configurations :
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).