Skip to content

IBX-9898: Added mandatory admin user password altering on ibexa:install #525

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

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

konradoboza
Copy link
Contributor

@konradoboza konradoboza commented Apr 18, 2025

🎫 Issue IBX-9898

Description:

We don't want to risk having the default admin:publish scenario for the new installations so I added invocation of existing command for updating user password. Since there in no obvious way to perform retry, I added exhaustive explanation on how admin default password should be altered afterwards in case it does not go through validation. Wording can be probably better so I allow myself to ask @juskora for help here. 😉

Retries are apparently possible as @Steveb-p nicely pointed out - added as below:

Zrzut ekranu 2025-04-18 o 14 06 28

Note:

There are two unrelated PHPStan reports. While there are easy to fix, I don't want to give you additional load of rebasing since you handle upgrading to Sf7 already @alongosz. However, if it ticks one of the issues from the list I can do that on this very occasion with a little hassle.

Documentation:

@konradoboza konradoboza self-assigned this Apr 18, 2025
@konradoboza konradoboza requested review from alongosz, juskora and a team April 18, 2025 10:35
@alongosz alongosz added the Doc needed The changes require some documentation label Apr 18, 2025
@konradoboza konradoboza changed the title Added mandatory admin user password altering on ibexa:install IBX-9898: Added mandatory admin user password altering on ibexa:install Apr 18, 2025
@alongosz
Copy link
Member

alongosz commented Apr 18, 2025

@ibexa/documentation I've added this to upgrade from 4.6 to 5.0 internal doc and marked it as a significant, but necessary, BC break.

FYI @glye you might want to take a look at this. This is a security improvement (not a security issue ;) ).

Copy link
Member

@alongosz alongosz left a comment

Choose a reason for hiding this comment

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

+1 for the concept, with remarks from the internal discussion.

@alongosz alongosz requested a review from a team April 18, 2025 11:08
@mnocon
Copy link
Contributor

mnocon commented Apr 18, 2025

I'd suggest adding a --no-interaction flag for CI runs, what do you think about it?

@konradoboza
Copy link
Contributor Author

I'd suggest adding a --no-interaction flag for CI runs, what do you think about it?

That was the plan actually.

@Steveb-p
Copy link
Contributor

I'd suggest adding a --no-interaction flag for CI runs, what do you think about it?

That was the plan actually.

You should use --no-interaction flag only if the original command was non-interactive as well. At least with the solution I proposed it should work nicely.

@juskora
Copy link
Contributor

juskora commented Apr 18, 2025

@konradoboza I suggest this with small modification :)

`For security reasons, you're required to change the default admin password.
Remember to follow currently set password validation rules as there is only one attempt.

If password isn't accepted now, you can still update it after the installation, using the following command:`

@konradoboza
Copy link
Contributor Author

Thanks @juskora! If it indeed works with retries as Paweł suggests we might not need that. Otherwise, I will apply your suggestion at once. 😉

@konradoboza konradoboza requested review from Steveb-p, alongosz, mnocon and a team April 18, 2025 12:09
Copy link
Contributor

@juskora juskora left a comment

Choose a reason for hiding this comment

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

In terms of microcopy :)

@konradoboza konradoboza requested a review from Steveb-p April 18, 2025 12:25
@konradoboza konradoboza requested a review from a team April 22, 2025 06:20
Copy link
Contributor

@glye glye left a comment

Choose a reason for hiding this comment

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

Great feature, thanks!

@konradoboza
Copy link
Contributor Author

The Behat tests setup needs to be slightly adjusted to skip checking the password. Probably --no-interaction flag will do the trick, I let myself adding Ready for QA label to have some assistance with that. 😉

@alongosz alongosz requested a review from a team April 22, 2025 08:29
@konradoboza konradoboza force-pushed the added-mandatory-admin-password-altering branch from c53addf to b0f3010 Compare April 22, 2025 10:02
Copy link

@vidarl
Copy link
Contributor

vidarl commented Apr 22, 2025

FYI : ibexa:install is executed when provisioning on Ibexa Cloud and the script still needs to run without user prompt there.

@konradoboza
Copy link
Contributor Author

FYI : ibexa:install is executed when provisioning on Ibexa Cloud and the script still needs to run without user prompt there.

Good catch, thank you. This should do the trick ibexa/post-install#91.

@vidarl
Copy link
Contributor

vidarl commented Apr 25, 2025

Could you also add the possibility to provide password as command line argument?
That would make it possible to run installation non-interactive, and still not have the default publish password

@konradoboza
Copy link
Contributor Author

Could you also add the possibility to provide password as command line argument?
That would make it possible to run installation non-interactive, and still not have the default publish password

If you consider this for Ibexa Cloud installations I don't think this is safe to pass that in plain text and put in .platform.app.yaml.

@vidarl
Copy link
Contributor

vidarl commented Apr 25, 2025

If you consider this for Ibexa Cloud installations I don't think this is safe to pass that in plain text and put in .platform.app.yaml.

I think it is valid use-case to be able to install Ibexa DXP with a custom password without having to be prompted by the installer.

For Ibexa Cloud I actually think we in addtion should have a --generate-admin-password options that generates a random password. That password would then also needs to be outputed, so that the end-user can learn it from the logs. That would still be way safer than continue using the default password

@konradoboza
Copy link
Contributor Author

konradoboza commented Apr 25, 2025

We discussed this topic within the team and the outcome is that we don't want to have plain password passed as a parameter in commands (including ibexa:install) for security reasons. The same approach was taken for ibexa/user#86.

For Ibexa Cloud I actually think we in addtion should have a --generate-admin-password options that generates a random password. That password would then also needs to be outputed, so that the end-user can learn it from the logs. That would still be way safer than continue using the default password

This is a bit tricky cause we need to have this password generated and validated against all the current constraints residing in ibexa/user. This is a topic for another story/improvement which we don't want to start with this PR.

The main idea here was to quickly resolve issue with the default admin:publish going silently to production installations. That being said we want this PR to be merged in the current shape as long as we don't find any issues.

Thank you for good suggestions, those should definitely be documented.

@glye could I kindly ask you to include the above in your notes? 😉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Doc needed The changes require some documentation Improvement Ready for QA
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants