-
Notifications
You must be signed in to change notification settings - Fork 37
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
Add force_readonly
option for owner of a FOREIGN SERVER
in context of SQLite connection management
#78
Add force_readonly
option for owner of a FOREIGN SERVER
in context of SQLite connection management
#78
Conversation
@mkgrgis , Please let me share my thought. |
This option is usefully in multi-user environment for security reasons.
Please explain where have I mistaken, @t-kataym. |
86e3d56
to
608e71c
Compare
608e71c
to
deda9ca
Compare
@t-kataym , let's continue review of this PR. SQLite (and Firebird) data access model is not only SQL like in Oracle, MariaDB or PostgreSQL, because significantly based on OS file permissions and I think we should give to foreign server owner some instruments with similar security effect without access to PostgreSQL server file system. In the new version of |
force_readonly
and updatable
options with testsforce_readonly
option with tests
Hello, @mkgrgis I'm sorry for my late reply.
I think you can control it with PostgreSQL feature without this PR. Could you explain a situation which cannot realize on only PostgreSQL feature? |
I am trying to prepare this SQL mutiuser use case. |
@t-kataym , I have made a research about most popular relational FDWs for PostgreSQL. In this PR I have implemented data access control under remote connection level. In case of SQLite there is only primitive file open mode, no SQL |
Hello @mkgrgis , thanks for your effort. I would like to share my opinion about this PR. In my understanding, you are going to provide an option to allow user to control data access at FDW level, via 2 options In my opinion, I think it is confusing when providing 2 options to do the same thing. |
Hello, @son-phamngoc ! Thanks for Your opinion, I'll comment it.
Please note, for other relational FDWs also there is remote
Yes. Grants or revokes of Oracle or PosrgreSQL remote user also ignores all of In SQLite we have no "remote"-like global access control except to file open mode. The specifics of our FDW is that both access controls methods concentrates inside of FDW: universal but not obligatory
Not the same thing, @son-phamngoc. With
Users of other relational FDWs can understand
Yes, this was my first not correct proposal. To avoid inconsistency with |
@mkgrgis Thanks for your explanation.
I understand that Could you tell me an actual use case that you need to use |
Yes, let's discuss real example. |
Short description of this PR: implement remote database admin role for |
@mkgrgis Could you help me to confirm which way of understanding matches your example?
I think the 2nd matches your example. |
@son-phamngoc , I am sorry for not clear clarification, really the example is near your 2 version.
No, there are many foreign servers in PostgreSQL, but there is main
Students does not have permission to change any data of main
No. This limitation is very rare, even if a student tell to the Professor not to see some data of the main
Yes. There is not only main
Yes. Students works with data from the main
Yes. This is group of
Yes. But students cannot create or change a
Yes.
Yes, but this is not 1st and 2nd versions, this is only different aspects of the example. I am sorry for not good clarification, @son-phamngoc . I hope now we have no misunderstanding. |
@son-phamngoc , in README added detailed description with diagnostics description in 087b3a3 and 6e6c74e |
Hello @mkgrgis , thanks for your answer. I think I understood the necessity of this option. I would like to describe the necessity of this option like this:
Could you add it to README? About the implementation, I have not started review yet, but please let me share my thought.
I remember that we have already discussed about that in #59. |
Add about force_readonly
Yes. There is no use case difference with other FDWs, but there is difference of implementation. The description have completed in f92ee42
About the implementation...
Yes, this is implemented, but not only. In other FDWs similar "grant user permission to create a foreign table and revoke user permission to modify table data" conditions implementation based on remote database internal structures. I think in our case we also can use remote database structures which is internal SQLite function in our case. Any |
Thank you for your update.
About the implementation of SQLite connection, I commented about it before, in #59. |
Added tests allow us ensure there are no problems for any existed functions with
Please allow me share opinion of antivirus or SELinux security administrator. There is security rule: "you shouldn't collect unusable privileges". PostgreSQL server is well-tested program, but it's hard to run it with |
@mkgrgis Sorry for late respond. |
No problems, @son-phamngoc. I understand there is unusual for you external C programming in the PR. Really this is more to POSIX side, not to SQL.
Does I need to provide some external tests for file access mode descriptors |
No, you don't need to provide more test. |
Thanks, @son-phamngoc , common description is updated #78 (comment) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mkgrgis I added some comments. Could you check them?
Thanks for 1st review, @son-phamngoc ! Let's begin a 2nd review round? |
force_readonly
option with testsforce_readonly
option for owner of a FOREIGN SERVER
in context of SQLite connection management
Ping, @t-kataym ? |
@mkgrgis Thank you for your contribution. I will accept the PR. |
In this PR:
force_readonly
option based onsqlite3_open_v2
functionSQLITE_OPEN_READONLY
mode and can disallow any changes in SQLite database. Hence ifforce_readonly
set totrue
any values ofupdatable
options are ignored. Ifforce_readonly
set tofalse
or not set there is usual behaviour ofupdatable
option like inpostgres_fdw
.