diqiu50 commented on code in PR #13204:
URL: https://github.com/apache/gravitino/pull/13204#discussion_r4026930359
##########
core/src/main/java/org/apache/gravitino/secret/SecretPropertyOperationDispatcher.java:
##########
@@ -242,9 +258,55 @@ private Map<String, String>
loadModelVersionRawProperties(NameIdentifier identif
modelVersion =
wrapper.doWithModelOps(ops -> ops.getModelVersion(modelIdent,
versionName));
}
- return modelVersion.properties() == null ? Map.of() :
modelVersion.properties();
+ Map<String, String> raw =
+ modelVersion.properties() == null ? Map.of() :
modelVersion.properties();
+ return new RawPropertiesAndMetadata(
+ raw,
+ propertiesMetadataOrNull(
+ wrapper,
HasPropertyMetadata::modelVersionPropertiesMetadata));
},
NoSuchCatalogException.class,
NoSuchModelVersionException.class);
}
+
+ private Map<String, String> loadMetalakeRawProperties(NameIdentifier
identifier) {
+ try {
+ BaseMetalake entity = store.get(identifier, Entity.EntityType.METALAKE,
BaseMetalake.class);
+ return entity.properties() == null ? Map.of() : entity.properties();
+ } catch (NoSuchEntityException e) {
+ throw new NoSuchMetalakeException(e, "Metalake %s does not exist",
identifier);
+ } catch (IOException e) {
+ throw new RuntimeException("Failed to load metalake entity " +
identifier, e);
+ }
+ }
+
+ /**
+ * Returns properties metadata under the catalog connector classloader, or
{@code null} when the
+ * catalog does not support it for this entity type.
+ */
+ @Nullable
+ static PropertiesMetadata propertiesMetadataOrNull(
+ CatalogManager.CatalogWrapper wrapper,
+ ThrowableFunction<HasPropertyMetadata, PropertiesMetadata> getter) {
+ try {
+ return wrapper.doWithPropertiesMeta(getter);
+ } catch (UnsupportedOperationException e) {
+ return null;
Review Comment:
Returning null here makes buildSecrets fall back to the permissive mode,
which returns every sensitive-named key in plaintext — including the declared
non-hidden keys this PR intentionally excludes (credential-providers,
s3-access-key-id, ...).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]