Skip to content
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

Eliminate persistence of secrets entirely #522

Merged
merged 1 commit into from
Dec 10, 2024

Conversation

snazy
Copy link
Member

@snazy snazy commented Dec 10, 2024

Clear text secrets must never be persisted, hence the attributes in ModelPrincipalSecrets needs to be removed.

Copy link
Contributor

@dimas-b dimas-b left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 to removing secret fields from the JPA model.

} else {
var principalSecrets = secretsResult.getPrincipalSecrets();
System.out.printf(
"Bootstrap realm '%s' - root principal credentials: %s secret: %s",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to always print this? Users can provide their own secrets for bootstrapping via env. variables.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I agree that it's a good idea to remove secret fields from JPA classes

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW: I've intentionally chosen System.out over LOGGER - it's not yet great though.

Copy link
Contributor

@dimas-b dimas-b Dec 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Clear text secrets must never be persisted, hence the attributes in `ModelPrincipalSecrets` needs to be removed.
@snazy snazy force-pushed the no-way-to-persist-secrets branch from 20a9389 to c05d02f Compare December 10, 2024 15:49
@snazy snazy merged commit a2cdcf8 into apache:main Dec 10, 2024
5 checks passed
@snazy snazy deleted the no-way-to-persist-secrets branch December 10, 2024 16:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants