[#11263] feat(authz): Extend credential vending to Hive/Iceberg/Glue/JDBC catalog types - #11264
Conversation
…, Doris and StarRocks JDBC catalogs
There was a problem hiding this comment.
Pull request overview
Extends JDBC credential vending (introduced for MySQL in #11149) to PostgreSQL, Doris, and StarRocks JDBC catalogs, and relaxes the credential provider to permit empty-string passwords so StarRocks (which uses an empty password by default) works.
Changes:
- Loosen the password check in
JdbcCredentialProviderandJdbcCatalog.applyDefaultCredentialProvidersto allow non-null empty passwords; add a Trino PostgreSQL connector adapter test and Spark PG IT explicit provider config. - Add new catalog credential ITs for PostgreSQL, Doris, and StarRocks (plus a unit test for the empty-password path in
TestJdbcCatalogCredential). - Add the
PG_CATALOG_CREDENTIAL_ITtest-database enum entry (lowercased for PostgreSQL).
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| core/src/main/java/org/apache/gravitino/credential/JdbcCredentialProvider.java | Allow empty-string password (only reject null). |
| catalogs/catalog-jdbc-common/src/main/java/org/apache/gravitino/catalog/jdbc/JdbcCatalog.java | Register default JDBC credential provider when password is non-null (not non-blank). |
| catalogs/catalog-jdbc-common/src/test/java/org/apache/gravitino/catalog/jdbc/TestJdbcCatalogCredential.java | Add unit test asserting provider registration with empty password. |
| catalogs/catalog-jdbc-postgresql/.../CatalogPostgreSqlCredentialIT.java | New PostgreSQL credential vending IT. |
| catalogs/catalog-jdbc-doris/.../CatalogDorisCredentialIT.java | New Doris credential vending IT. |
| catalogs/catalog-jdbc-starrocks/.../CatalogStarRocksCredentialIT.java | New StarRocks credential vending IT (exercises empty password). |
| integration-test-common/.../TestDatabaseName.java | Add PG_CATALOG_CREDENTIAL_IT enum entry with lowercase toString(). |
| spark-connector/.../SparkJdbcPostgreSqlCatalogIT.java | Explicitly enable jdbc-user-password credential provider for Spark PG IT. |
| trino-connector/.../TestPostgreSQLConnectorAdapter.java | New unit test verifying vended credentials override Trino PG connector config and fallback when none. |
…ns to core module Move S3/OSS/Azure/GCS PropertiesMetadata classes to org.apache.gravitino.cloud.storage in core, so Hive and Iceberg catalog property metadata can reuse them via putAll() instead of defining duplicate inline entries.
…e methods Introduce addCatalogSpecificCredentialProviders() and hiddenCredentialKeys() hooks in BaseCatalog so that propertiesWithCredentialProviders() and properties() backfill are no longer duplicated across Hive, Iceberg, and Jdbc catalogs.
…ckfill Replace the explicit hiddenCredentialKeys() hook with a loop over entity properties that checks catalogPropertiesMetadata().isHiddenProperty(), eliminating duplicate key lists in each catalog subclass.
…ckfill Backfill should only re-add credential properties, not all hidden properties (e.g. PROPERTY_IN_USE is hidden but must not be backfilled). Restore the hiddenCredentialKeys() hook so each catalog declares its own credential keys.
…) and propertiesWithCredentialProviders() When backfill is enabled, properties() starts from the filtered public map and fills in any missing keys from propertiesWithCredentialProviders(), which carries the raw entity properties including hidden credentials. This removes the need for the explicit hiddenCredentialKeys() hook in each catalog subclass.
Delegate properties() directly to propertiesWithCredentialProviders() when backfill is enabled, avoiding redundant merge. Remove temporary design doc that was not intended to be committed.
Mark aws-secret-access-key as hidden. Override addCatalogSpecificCredentialProviders to map Glue AWS credentials to S3 property keys, enabling automatic S3 credential provider registration. Fix NPE in shouldBackfillCredential when config entry returns null.
…ovider and catalogs
Code Coverage Report
Files |
…nfigProvider to include hidden JDBC credentials
… usage in DynamicIcebergConfigProvider
…ng credential recovery strategies
…o connectors - Add getCredentials/applyIcebergCredentials/applyPaimonCredentials helpers to CredentialPropertyUtils to eliminate duplicated credential injection logic - Flink/Spark Hive: inject S3, OSS, and Azure credentials into catalog config - Flink/Spark Iceberg: inject JDBC and all storage credentials via shared utility - Flink/Spark Paimon: inject JDBC, S3, and OSS credentials via shared utility - Flink Iceberg/Paimon: defer inner catalog creation to open() so credentials can be fetched before initialization - Trino Hive: inject S3 and Azure credentials - Trino Glue: replace broken static property reading with credential vending - Trino Iceberg: inject JDBC, S3, OSS, and Azure credentials - Add WARN logging for unknown credential types and NoSuchCatalogException - Fix stale TestGlueConnectorAdapter test to use S3SecretKeyCredential
…and Paimon catalogs
…al backfill is enabled
| Preconditions.checkArgument(StringUtils.isNotBlank(jdbcUser), "JDBC user should not be empty"); | ||
| Preconditions.checkArgument( | ||
| StringUtils.isNotBlank(jdbcPassword), "JDBC password should not be empty"); | ||
| Preconditions.checkArgument(jdbcPassword != null, "JDBC password should not be null"); |
There was a problem hiding this comment.
JDBC password can be empty string?
There was a problem hiding this comment.
Yes,StarRocks required
| config.put(HIVE_METASTORE_GLUE_SECRET_KEY, s3.secretAccessKey()); | ||
| config.put(HIVE_S3_ACCESS_KEY, s3.accessKeyId()); | ||
| config.put(HIVE_S3_SECRET_KEY, s3.secretAccessKey()); | ||
| return; |
There was a problem hiding this comment.
Does Glue not support Azure credentials as follows?
There was a problem hiding this comment.
S3 is the only supported type?
There was a problem hiding this comment.
Glue is typically used on AWS, so it generally works with S3. Other requirements can be support as needed.
| super.open(); | ||
| } | ||
|
|
||
| static void applyS3Credential(Catalog catalog, Configuration conf) { |
There was a problem hiding this comment.
This one is almost the same as that in GravitinoHiveCatalog in spark connector.
There was a problem hiding this comment.
The logic is similar but the connector APIs differ (Configuration vs Map<String, String>), so they can't share the same method directly.
| * @return true if backfill is enabled | ||
| */ | ||
| protected boolean shouldBackfillCredential() { | ||
| Config serverConfig = GravitinoEnv.getInstance().config(); |
…/Flink connectors
- Add S3SecretKeyProvider ServiceLoader support to catalog-glue via runtimeOnly bundles/aws dep
- Override propertiesWithCredentialProviders() in GlueCatalog to always apply aws-* → s3-* key mapping
- Mark aws-access-key-id and aws-secret-access-key as hidden in GlueCatalogPropertiesMetadata
- Inject vended S3 credentials into GravitinoGlueCatalog for both Hive and Iceberg table paths
- Simplify GravitinoIcebergCatalogFlink{118,119,120} by removing redundant createIcebergCatalog helper
…nts in credential classes - Mark aws-access-key-id, s3-access-key-id, oss-access-key-id, azure-storage-account-name as hidden - Extract ICEBERG_JDBC_USER/PASSWORD and PAIMON_S3/OSS key constants in CredentialPropertyUtils - Simplify shouldBackfillCredential() by removing redundant null check on server config
|
The term "all catalog types" in the PR title may be misleading, as other catalogs (such as Kafka) are not currently supported. right? |
…mple auth is default IdpRESTFeature.validateConfiguration() calls System.exit(1) when 'simple' is in gravitino.authenticators. Configure oauth as the base authenticator (matching IdpRESTApiIT) so the server starts cleanly; BasicAuthenticator is registered on top by the IDP plugin.
|
I have no more comments. |
|
@diqiu50 please resolve conflicts |
…end them at the fileset level Hide cloud storage credential properties (S3/OSS/Azure access & secret keys) from the fileset catalog/schema/fileset properties() by reusing the shared hidden PropertyEntry definitions in core, consistent with the JDBC catalog (apache#11149) and Hive/Iceberg/Glue (apache#11264). To keep the "client without credentials, using server-side credentials" flow working after hiding, make fileset-level (path-based) credential vending infer the storage credential provider from static credentials when no explicit credential-providers is set. The detection is extracted into CredentialUtils.getStorageCredentialProviders and reused by BaseCatalog, so it mirrors catalog-level vending: a catalog configured with only static credentials can now vend them at the fileset level. GVFS clients that do not provide credentials must enable credential vending (fs.gravitino.enableCredentialVending=true) to obtain the server-side credentials. When credentials are missing and vending is disabled, GVFS now surfaces an actionable AccessDenied message pointing to the right config.
What changes were proposed in this pull request?
BaseCatalog.addCatalogSpecificCredentialProviders()hook to eliminate duplicationPropertyEntrydefinitions tocoremoduleJdbcCredentialProviderto allow empty-string JDBC passwordsDynamicIcebergConfigProviderstandalone mode to include hidden JDBC credentialsWhy are the changes needed?
Fix: #11263
Does this PR introduce any user-facing change?
Glue, Hive, Iceberg, and Paimon catalogs now support credential vending.
How was this patch tested?
Add unit tests and integration tests.