markhoerth opened a new issue, #14306:
URL: https://github.com/apache/gravitino/issues/14306

   ### Version
   
   main branch (2.0.0-SNAPSHOT, eb988d1)
   
   ### Describe what's wrong
   
   When a catalog property is bound to a secret and the secret provider can no 
longer return it,
   the catalog becomes impossible to manage:
   
   - `PATCH .../catalogs/{catalog}` with `{"inUse": false}` returns 400.
   - `DELETE .../catalogs/{catalog}?force=true` returns 400.
   - `PUT .../catalogs/{catalog}` with a `setSecretBinding` to supply a new 
secret returns 400.
   - `GET .../catalogs?details=true` returns 400 for the whole metalake, so 
every other catalog
     disappears from the detailed listing as well.
   
   All four fail with "Secret not found for URN: urn:gravitino-secret:...". 
Each of these operations
   builds the catalog instance, and building it resolves every secret first:
   `CatalogManager.createBaseCatalog` 
(`core/src/main/java/org/apache/gravitino/catalog/CatalogManager.java:1938`)
   calls `secretManager.toPlaintextProperties(...)` at `:1955`, which reads 
each secret
   (`core/src/main/java/org/apache/gravitino/secret/SecretManager.java:533`) 
and throws when the
   provider has none 
(`common/src/main/java/org/apache/gravitino/secret/memory/InMemorySecretsProvider.java:81`).
   
   Problem scenario: a secret is deleted or rotated away in the external secret 
store, or the
   in-memory provider loses its secrets on a server restart. The catalog that 
references it can then
   be neither repaired, disabled nor removed through the API, and a UI that 
lists catalogs with
   details shows none at all for that metalake.
   
   ### Error message and/or stacktrace
   
   ```
   HTTP 400 {"code":1001,"type":"IllegalArgumentException","message":"Failed to 
operate catalog(s) [c1] operation [DROP] under metalake [m1], reason [Secret 
not found for URN: 
urn:gravitino-secret:memory:catalog:1113935276256402319:jdbc-password]"}
   ```
   
   ### How to reproduce
   
   1. Configure `gravitino.secret.providers = memory`.
   2. Create a catalog with a secret binding, for example a fileset catalog with
      `"secretBindings": {"api-token": {"provider": "memory", "plaintext": 
"x"}}`.
   3. Restart the server (the memory provider starts empty).
   4. Disable, drop, re-bind or list with details: each returns 400.
   
   ### Additional context
   
   Requirement: disabling, dropping and re-binding a catalog do not need its 
old secrets resolved; a
   listing reports the catalog it cannot resolve without failing the others.
   Related: #12297.


-- 
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]

Reply via email to