You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@polaris.apache.org by "snazy (via GitHub)" <gi...@apache.org> on 2024/12/10 14:52:29 UTC
[PR] Eliminate persistence of secrets entirely [polaris]
snazy opened a new pull request, #522:
URL: https://github.com/apache/polaris/pull/522
Clear text secrets must never be persisted, hence the attributes in `ModelPrincipalSecrets` needs to be removed.
--
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: issues-unsubscribe@polaris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Eliminate persistence of secrets entirely [polaris]
Posted by "snazy (via GitHub)" <gi...@apache.org>.
snazy commented on code in PR #522:
URL: https://github.com/apache/polaris/pull/522#discussion_r1878310418
##########
polaris-service/src/main/java/org/apache/polaris/service/BootstrapRealmsCommand.java:
##########
@@ -49,22 +48,24 @@ protected void run(
MetaStoreManagerFactory metaStoreManagerFactory =
configuration.findService(MetaStoreManagerFactory.class);
- PolarisConfigurationStore configurationStore =
- configuration.findService(PolarisConfigurationStore.class);
-
// Execute the bootstrap
Map<String, PrincipalSecretsResult> results =
metaStoreManagerFactory.bootstrapRealms(configuration.getDefaultRealms());
// Log any errors:
boolean success = true;
for (Map.Entry<String, PrincipalSecretsResult> result : results.entrySet()) {
+ var realmId = result.getKey();
+ var secretsResult = result.getValue();
if (!result.getValue().isSuccess()) {
LOGGER.error(
- "Bootstrapping `{}` failed: {}",
- result.getKey(),
- result.getValue().getReturnStatus().toString());
+ "Bootstrapping `{}` failed: {}", realmId, secretsResult.getReturnStatus().toString());
success = false;
+ } else {
+ var principalSecrets = secretsResult.getPrincipalSecrets();
+ System.out.printf(
+ "Bootstrap realm '%s' - root principal credentials: %s secret: %s",
Review Comment:
> secrets are not stored in EclipseLink anyway
The problem is, that it is possible - and before this change the clear text secrets were passed down to EL and therefore the database, which is IMHO an absolute no-go. But even if it was not the case, the fact that it _could_ happen is not good.
--
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: issues-unsubscribe@polaris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Eliminate persistence of secrets entirely [polaris]
Posted by "dimas-b (via GitHub)" <gi...@apache.org>.
dimas-b commented on code in PR #522:
URL: https://github.com/apache/polaris/pull/522#discussion_r1878269641
##########
polaris-service/src/main/java/org/apache/polaris/service/BootstrapRealmsCommand.java:
##########
@@ -49,22 +48,24 @@ protected void run(
MetaStoreManagerFactory metaStoreManagerFactory =
configuration.findService(MetaStoreManagerFactory.class);
- PolarisConfigurationStore configurationStore =
- configuration.findService(PolarisConfigurationStore.class);
-
// Execute the bootstrap
Map<String, PrincipalSecretsResult> results =
metaStoreManagerFactory.bootstrapRealms(configuration.getDefaultRealms());
// Log any errors:
boolean success = true;
for (Map.Entry<String, PrincipalSecretsResult> result : results.entrySet()) {
+ var realmId = result.getKey();
+ var secretsResult = result.getValue();
if (!result.getValue().isSuccess()) {
LOGGER.error(
- "Bootstrapping `{}` failed: {}",
- result.getKey(),
- result.getValue().getReturnStatus().toString());
+ "Bootstrapping `{}` failed: {}", realmId, secretsResult.getReturnStatus().toString());
success = false;
+ } else {
+ var principalSecrets = secretsResult.getPrincipalSecrets();
+ System.out.printf(
+ "Bootstrap realm '%s' - root principal credentials: %s secret: %s",
Review Comment:
Also, IIRC, secrets are not stored in EclipseList anyway and the in-memory persistence prints the generated secrets in `InMemoryPolarisMetaStoreManagerFactory` (end of file).
I tend to think this printout is not necessary.
##########
polaris-service/src/main/java/org/apache/polaris/service/BootstrapRealmsCommand.java:
##########
@@ -49,22 +48,24 @@ protected void run(
MetaStoreManagerFactory metaStoreManagerFactory =
configuration.findService(MetaStoreManagerFactory.class);
- PolarisConfigurationStore configurationStore =
- configuration.findService(PolarisConfigurationStore.class);
-
// Execute the bootstrap
Map<String, PrincipalSecretsResult> results =
metaStoreManagerFactory.bootstrapRealms(configuration.getDefaultRealms());
// Log any errors:
boolean success = true;
for (Map.Entry<String, PrincipalSecretsResult> result : results.entrySet()) {
+ var realmId = result.getKey();
+ var secretsResult = result.getValue();
if (!result.getValue().isSuccess()) {
LOGGER.error(
- "Bootstrapping `{}` failed: {}",
- result.getKey(),
- result.getValue().getReturnStatus().toString());
+ "Bootstrapping `{}` failed: {}", realmId, secretsResult.getReturnStatus().toString());
success = false;
+ } else {
+ var principalSecrets = secretsResult.getPrincipalSecrets();
+ System.out.printf(
+ "Bootstrap realm '%s' - root principal credentials: %s secret: %s",
Review Comment:
Do we want to always print this? Users can provide their own secrets for bootstrapping via env. variables.
--
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: issues-unsubscribe@polaris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Eliminate persistence of secrets entirely [polaris]
Posted by "snazy (via GitHub)" <gi...@apache.org>.
snazy commented on code in PR #522:
URL: https://github.com/apache/polaris/pull/522#discussion_r1878306413
##########
polaris-service/src/main/java/org/apache/polaris/service/BootstrapRealmsCommand.java:
##########
@@ -49,22 +48,24 @@ protected void run(
MetaStoreManagerFactory metaStoreManagerFactory =
configuration.findService(MetaStoreManagerFactory.class);
- PolarisConfigurationStore configurationStore =
- configuration.findService(PolarisConfigurationStore.class);
-
// Execute the bootstrap
Map<String, PrincipalSecretsResult> results =
metaStoreManagerFactory.bootstrapRealms(configuration.getDefaultRealms());
// Log any errors:
boolean success = true;
for (Map.Entry<String, PrincipalSecretsResult> result : results.entrySet()) {
+ var realmId = result.getKey();
+ var secretsResult = result.getValue();
if (!result.getValue().isSuccess()) {
LOGGER.error(
- "Bootstrapping `{}` failed: {}",
- result.getKey(),
- result.getValue().getReturnStatus().toString());
+ "Bootstrapping `{}` failed: {}", realmId, secretsResult.getReturnStatus().toString());
success = false;
+ } else {
+ var principalSecrets = secretsResult.getPrincipalSecrets();
+ System.out.printf(
+ "Bootstrap realm '%s' - root principal credentials: %s secret: %s",
Review Comment:
We need this printout for the EL variant. The in-memory thing doesn't even have/need an explicit bootstrap - all realms are implicitly created, as many as you want (it's not intuitive and I think that behavioral difference should really be changed).
--
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: issues-unsubscribe@polaris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Eliminate persistence of secrets entirely [polaris]
Posted by "snazy (via GitHub)" <gi...@apache.org>.
snazy merged PR #522:
URL: https://github.com/apache/polaris/pull/522
--
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: issues-unsubscribe@polaris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Eliminate persistence of secrets entirely [polaris]
Posted by "dimas-b (via GitHub)" <gi...@apache.org>.
dimas-b commented on code in PR #522:
URL: https://github.com/apache/polaris/pull/522#discussion_r1878326645
##########
polaris-service/src/main/java/org/apache/polaris/service/BootstrapRealmsCommand.java:
##########
@@ -49,22 +48,24 @@ protected void run(
MetaStoreManagerFactory metaStoreManagerFactory =
configuration.findService(MetaStoreManagerFactory.class);
- PolarisConfigurationStore configurationStore =
- configuration.findService(PolarisConfigurationStore.class);
-
// Execute the bootstrap
Map<String, PrincipalSecretsResult> results =
metaStoreManagerFactory.bootstrapRealms(configuration.getDefaultRealms());
// Log any errors:
boolean success = true;
for (Map.Entry<String, PrincipalSecretsResult> result : results.entrySet()) {
+ var realmId = result.getKey();
+ var secretsResult = result.getValue();
if (!result.getValue().isSuccess()) {
LOGGER.error(
- "Bootstrapping `{}` failed: {}",
- result.getKey(),
- result.getValue().getReturnStatus().toString());
+ "Bootstrapping `{}` failed: {}", realmId, secretsResult.getReturnStatus().toString());
success = false;
+ } else {
+ var principalSecrets = secretsResult.getPrincipalSecrets();
+ System.out.printf(
+ "Bootstrap realm '%s' - root principal credentials: %s secret: %s",
Review Comment:
Yes, I agree that it's a good idea to remove secret fields from JPA classes
--
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: issues-unsubscribe@polaris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Eliminate persistence of secrets entirely [polaris]
Posted by "dimas-b (via GitHub)" <gi...@apache.org>.
dimas-b commented on code in PR #522:
URL: https://github.com/apache/polaris/pull/522#discussion_r1878341661
##########
polaris-service/src/main/java/org/apache/polaris/service/BootstrapRealmsCommand.java:
##########
@@ -49,22 +48,24 @@ protected void run(
MetaStoreManagerFactory metaStoreManagerFactory =
configuration.findService(MetaStoreManagerFactory.class);
- PolarisConfigurationStore configurationStore =
- configuration.findService(PolarisConfigurationStore.class);
-
// Execute the bootstrap
Map<String, PrincipalSecretsResult> results =
metaStoreManagerFactory.bootstrapRealms(configuration.getDefaultRealms());
// Log any errors:
boolean success = true;
for (Map.Entry<String, PrincipalSecretsResult> result : results.entrySet()) {
+ var realmId = result.getKey();
+ var secretsResult = result.getValue();
if (!result.getValue().isSuccess()) {
LOGGER.error(
- "Bootstrapping `{}` failed: {}",
- result.getKey(),
- result.getValue().getReturnStatus().toString());
+ "Bootstrapping `{}` failed: {}", realmId, secretsResult.getReturnStatus().toString());
success = false;
+ } else {
+ var principalSecrets = secretsResult.getPrincipalSecrets();
+ System.out.printf(
+ "Bootstrap realm '%s' - root principal credentials: %s secret: %s",
Review Comment:
> We need this printout for the EL variant.
EL bootstrapping is already impossible without env. vars. Isn't is what #461 attempts to fix?
I believe the discussion there was moving away from printouts. I think it would be safer to remove secret JPA fields first (this does not make the bootstrapping situation worse) and then deal with the bootstrap command in a separate PR. (My preference would be writing generated secrets to a file.)
--
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: issues-unsubscribe@polaris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Eliminate persistence of secrets entirely [polaris]
Posted by "snazy (via GitHub)" <gi...@apache.org>.
snazy commented on code in PR #522:
URL: https://github.com/apache/polaris/pull/522#discussion_r1878358470
##########
polaris-service/src/main/java/org/apache/polaris/service/BootstrapRealmsCommand.java:
##########
@@ -49,22 +48,24 @@ protected void run(
MetaStoreManagerFactory metaStoreManagerFactory =
configuration.findService(MetaStoreManagerFactory.class);
- PolarisConfigurationStore configurationStore =
- configuration.findService(PolarisConfigurationStore.class);
-
// Execute the bootstrap
Map<String, PrincipalSecretsResult> results =
metaStoreManagerFactory.bootstrapRealms(configuration.getDefaultRealms());
// Log any errors:
boolean success = true;
for (Map.Entry<String, PrincipalSecretsResult> result : results.entrySet()) {
+ var realmId = result.getKey();
+ var secretsResult = result.getValue();
if (!result.getValue().isSuccess()) {
LOGGER.error(
- "Bootstrapping `{}` failed: {}",
- result.getKey(),
- result.getValue().getReturnStatus().toString());
+ "Bootstrapping `{}` failed: {}", realmId, secretsResult.getReturnStatus().toString());
success = false;
+ } else {
+ var principalSecrets = secretsResult.getPrincipalSecrets();
+ System.out.printf(
+ "Bootstrap realm '%s' - root principal credentials: %s secret: %s",
Review Comment:
Yes. I thought, you could get random secrets.
The whole bootstrap scenario is too complex overall. The In-mem thing bootstraps everything and logs - the EL thing does not log, but can generate creds (which you cannot get)... And quite some `if` special cases that make it complex to reason about the bootstrap process.
--
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: issues-unsubscribe@polaris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Eliminate persistence of secrets entirely [polaris]
Posted by "dimas-b (via GitHub)" <gi...@apache.org>.
dimas-b commented on code in PR #522:
URL: https://github.com/apache/polaris/pull/522#discussion_r1878341661
##########
polaris-service/src/main/java/org/apache/polaris/service/BootstrapRealmsCommand.java:
##########
@@ -49,22 +48,24 @@ protected void run(
MetaStoreManagerFactory metaStoreManagerFactory =
configuration.findService(MetaStoreManagerFactory.class);
- PolarisConfigurationStore configurationStore =
- configuration.findService(PolarisConfigurationStore.class);
-
// Execute the bootstrap
Map<String, PrincipalSecretsResult> results =
metaStoreManagerFactory.bootstrapRealms(configuration.getDefaultRealms());
// Log any errors:
boolean success = true;
for (Map.Entry<String, PrincipalSecretsResult> result : results.entrySet()) {
+ var realmId = result.getKey();
+ var secretsResult = result.getValue();
if (!result.getValue().isSuccess()) {
LOGGER.error(
- "Bootstrapping `{}` failed: {}",
- result.getKey(),
- result.getValue().getReturnStatus().toString());
+ "Bootstrapping `{}` failed: {}", realmId, secretsResult.getReturnStatus().toString());
success = false;
+ } else {
+ var principalSecrets = secretsResult.getPrincipalSecrets();
+ System.out.printf(
+ "Bootstrap realm '%s' - root principal credentials: %s secret: %s",
Review Comment:
> We need this printout for the EL variant.
EL bootstrapping is already impossible without env. vars. Isn't this what #461 attempts to fix?
I believe the discussion there was moving away from printouts. I think it would be safer to remove secret JPA fields first (this does not make the bootstrapping situation worse) and then deal with the bootstrap command in a separate PR. (My preference would be writing generated secrets to a file.)
--
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: issues-unsubscribe@polaris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Eliminate persistence of secrets entirely [polaris]
Posted by "snazy (via GitHub)" <gi...@apache.org>.
snazy commented on code in PR #522:
URL: https://github.com/apache/polaris/pull/522#discussion_r1878338909
##########
polaris-service/src/main/java/org/apache/polaris/service/BootstrapRealmsCommand.java:
##########
@@ -49,22 +48,24 @@ protected void run(
MetaStoreManagerFactory metaStoreManagerFactory =
configuration.findService(MetaStoreManagerFactory.class);
- PolarisConfigurationStore configurationStore =
- configuration.findService(PolarisConfigurationStore.class);
-
// Execute the bootstrap
Map<String, PrincipalSecretsResult> results =
metaStoreManagerFactory.bootstrapRealms(configuration.getDefaultRealms());
// Log any errors:
boolean success = true;
for (Map.Entry<String, PrincipalSecretsResult> result : results.entrySet()) {
+ var realmId = result.getKey();
+ var secretsResult = result.getValue();
if (!result.getValue().isSuccess()) {
LOGGER.error(
- "Bootstrapping `{}` failed: {}",
- result.getKey(),
- result.getValue().getReturnStatus().toString());
+ "Bootstrapping `{}` failed: {}", realmId, secretsResult.getReturnStatus().toString());
success = false;
+ } else {
+ var principalSecrets = secretsResult.getPrincipalSecrets();
+ System.out.printf(
+ "Bootstrap realm '%s' - root principal credentials: %s secret: %s",
Review Comment:
BTW: I've intentionally chosen `System.out` over `LOGGER` - it's not yet great though.
--
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: issues-unsubscribe@polaris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org