-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Source postgres: fix schema permission issue #19024
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
Source postgres: fix schema permission issue #19024
Conversation
Affected Connector ReportNOTE
|
Connector | Version | Changelog | Publish |
---|---|---|---|
source-alloydb |
1.0.17 |
✅ | ✅ |
source-alloydb-strict-encrypt |
1.0.17 |
✅ | ⚠ (not in seed) |
source-postgres-strict-encrypt |
1.0.30 |
✅ | ⚠ (not in seed) |
- See "Actionable Items" below for how to resolve warnings and errors.
✅ Destinations (0)
Connector | Version | Changelog | Publish |
---|
- See "Actionable Items" below for how to resolve warnings and errors.
✅ Other Modules (0)
Actionable Items
(click to expand)
Category | Status | Actionable Item |
---|---|---|
Version | ❌ mismatch |
The version of the connector is different from its normal variant. Please bump the version of the connector. |
⚠ doc not found |
The connector does not seem to have a documentation file. This can be normal (e.g. basic connector like source-jdbc is not published or documented). Please double-check to make sure that it is not a bug. |
|
Changelog | ⚠ doc not found |
The connector does not seem to have a documentation file. This can be normal (e.g. basic connector like source-jdbc is not published or documented). Please double-check to make sure that it is not a bug. |
❌ changelog missing |
There is no chnagelog for the current version of the connector. If you are the author of the current version, please add a changelog. | |
Publish | ⚠ not in seed |
The connector is not in the seed file (e.g. source_definitions.yaml ), so its publication status cannot be checked. This can be normal (e.g. some connectors are cloud-specific, and only listed in the cloud seed file). Please double-check to make sure that it is not a bug. |
❌ diff seed version |
The connector exists in the seed file, but the latest version is not listed there. This usually means that the latest version is not published. Please use the /publish command to publish the latest version. |
/test connector=connectors/source-postgres
Build PassedTest summary info:
|
/test connector=connectors/source-postgres-strict-encrypt
Build PassedTest summary info:
|
/test connector=connectors/source-postgres-strict-encrypt
Build PassedTest summary info:
|
/test connector=connectors/source-postgres
Build PassedTest summary info:
|
/test connector=connectors/source-alloydb-strict-encrypt
Build PassedTest summary info:
|
/test connector=connectors/source-alloydb
Build PassedTest summary info:
|
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.
Looking at the issue, I'm not sure we want to silently fail as we're doing. If I understand correctly, in the case where:
- User configures streams assc with schema they have access to
- User then has access revoked from some of the schemas
- User runs a sync, which appears to run successfully but data from the schemas that they no longer have access to fail
In this case, the user might wonder why records from certain schemas might be missing? But looking at this, we see that the same issue holds for table privilege.
We may want to throw a ConfigErrorException here instead
Related to this - am I correct in understanding that today, while calling |
Yes as answering on your last question. I started to work on issue that user gets permission denied exception during sync, but during investigation i found that user can choose tables from schemas without usage permissions during discovery. Pr is fixing root cause, and as far as we run this code before sync we will not catch such exception. For not skipping schema without permission silently we should add additional step during discovery for verifying schema permissions for all schemas that user specified during creating source, wdyt? |
I think that makes sense. Ideally, after this change, few people will get into the state as they will be unable to choose a schema during discovery that they do not have permissions for. It seems like we silently fail syncs today if the current user loses select privileges for a table as well? This just adds a similar failure mode to that case. Created https://github.com/airbytehq/airbyte-internal-issues/issues/2658 to track this partial sync scenario |
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.
Can you add a similar test for the discover() case too (discover shouldn't be returning tables assc with schemas user has no access to)
@@ -389,6 +389,7 @@ public Set<JdbcPrivilegeDto> getPrivilegesTableForCurrentUser(final JdbcDatabase | |||
FROM pg_class c | |||
JOIN pg_namespace n on c.relnamespace = n.oid | |||
WHERE has_table_privilege(c.oid, 'SELECT') | |||
AND has_schema_privilege(current_user, nspname, 'USAGE') |
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.
👍
…ma-permission-error' into omneshcheret/18161-postgres-schema-permission-error
…postgres-schema-permission-error
/publish connector=connectors/source-postgres-strict-encrypt
if you have connectors that successfully published but failed definition generation, follow step 4 here |
/publish connector=connectors/source-postgres
if you have connectors that successfully published but failed definition generation, follow step 4 here |
I merged to master to get it to the latest published change. |
What
Based on issue, during sync user gets permission denied for schema. Need to void using tables from schemas where user don't have USAGE permissions
How
Updatde query that fetch metadata for tables with checking USAGE permissions for schema, it fixes case when user could pick up tables from schemas without permission during discovery. But in case when permission was revoked from user between discovery and sync, all not permitted tables will be skipped without any error, but as far as it happens silently
user can be confused that number tables after sync are less than picked during discovery.
Recommended reading order
x.java
🚨 User Impact 🚨
Are there any breaking changes? What is the end result perceived by the user? If yes, please merge this PR with the 🚨🚨 emoji so changelog authors can further highlight this if needed.
Pre-merge Checklist
Expand the relevant checklist and delete the others.
New Connector
Community member or Airbyter
airbyte_secret
./gradlew :airbyte-integrations:connectors:<name>:integrationTest
.README.md
bootstrap.md
. See description and examplesdocs/integrations/<source or destination>/<name>.md
including changelog. See changelog exampledocs/integrations/README.md
airbyte-integrations/builds.md
Airbyter
If this is a community PR, the Airbyte engineer reviewing this PR is responsible for the below items.
/test connector=connectors/<name>
command is passing/publish
command described hereUpdating a connector
Community member or Airbyter
airbyte_secret
./gradlew :airbyte-integrations:connectors:<name>:integrationTest
.README.md
bootstrap.md
. See description and examplesdocs/integrations/<source or destination>/<name>.md
including changelog. See changelog exampleAirbyter
If this is a community PR, the Airbyte engineer reviewing this PR is responsible for the below items.
/test connector=connectors/<name>
command is passing/publish
command described hereConnector Generator
-scaffold
in their name) have been updated with the latest scaffold by running./gradlew :airbyte-integrations:connector-templates:generator:testScaffoldTemplates
then checking in your changesTests
Unit
Put your unit tests output here.
Integration
Put your integration tests output here.
Acceptance
Put your acceptance tests output here.