Repository navigation
make password an optional parameter/field in createAccount - #13955
DaanHoogland wants to merge 8 commits into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #13955 +/- ##
==========================================
Coverage 20.78% 20.78%
- Complexity 21928 21944 +16
==========================================
Files 6496 6496
Lines 591657 591828 +171
Branches 72592 72619 +27
==========================================
+ Hits 122956 123032 +76
- Misses 455356 455442 +86
- Partials 13345 13354 +9
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
🔴 Test Coverage Grade:
|
| Metric | Value |
|---|---|
| Line coverage | 25.89% |
| Branch coverage | 20.23% |
Grade Scale
| Grade | Line Coverage | Meaning |
|---|---|---|
| 🟢 A | ≥ 80% | Excellent - this code sleeps well at night 😴 |
| 🟡 B | 60-79% | Good - almost there, don't stop now 😉 |
| 🟠 C | 40-59% | Acceptable - your code is wearing a seatbelt, but no airbags 😬 |
| 🔴 D | 20-39% | Marginal - boldly shipping where no test has gone before 🖖 |
| ⛔ F | < 20% | Failing - tests? what tests? 🔥 |
Branch coverage is shown as a secondary signal. Grade is determined by line coverage.
View full Actions run
86b71c7 to
7fba665
Compare
|
@blueorangutan package |
|
@DaanHoogland a [SL] Jenkins job has been kicked to build packages. It will be bundled with no SystemVM templates. I'll keep you posted as I make progress. |
|
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 18980 |
@GaOrtiga did you happen to test? |
|
@blueorangutan test |
vishesh92
left a comment
There was a problem hiding this comment.
just one comment. rest looks good.
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Pull request overview
Updates account creation to allow omitting a password (notably for externally authenticated accounts like SAML/LDAP), and reflects that behavior in the UI and API validation.
Changes:
- UI: Hide password inputs when SAML is enabled, show informational message, and relax validation rules accordingly.
- API: Make
passwordoptional forcreateAccountand auto-generate a random password when absent/blank. - Tests: Update
CreateAccountCmdTestexpectations around null/empty passwords.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| ui/src/views/iam/AddAccount.vue | Conditionally hides password fields for SAML and updates client-side validation + request params. |
| ui/public/locales/en.json | Adds i18n string explaining that no password is needed for SAML accounts. |
| api/src/main/java/org/apache/cloudstack/api/command/admin/account/CreateAccountCmd.java | Makes password optional and generates a random password when blank. |
| api/src/test/java/org/apache/cloudstack/api/command/admin/account/CreateAccountCmdTest.java | Adjusts unit tests for the new password generation behavior. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
|
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 19184 |
…unt/CreateAccountCmd.java Co-authored-by: GaOrtiga <49285692+GaOrtiga@users.noreply.github.com>
c5f8b6a to
340145e
Compare
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Copilot review overview
6 open issues
The password fields are hidden whenform.samlenableis initially true, but this watcher won’t run… · New The password fields are hidden whenform.samlenableis initially true, but this watcher won’t run… · New Generating a random password whenever the client omitspasswordchanges the API semantics for all… · New Generating a random password whenever the client omitspasswordchanges the API semantics for all… · New Generating a random password whenever the client omitspasswordchanges the API semantics for all… · New This test validates password generation, but it asserts anINTERNAL_ERRORthat occurs only… · New
4 resolved since last review
This watcher won’t run on initial render, so ifform.samlenableis initially true (e.g.,… This changes behavior for callers that explicitly pass an empty/whitespace password: instead of… The assertion in the catch block is a no-op (assertTrue(..., true)always passes), and the test… The password length12is a magic number here. Prefer referencing an existing configured…
Review effort: Lite
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Copilot review overview
2 open issues
6 resolved since last review
The password fields are hidden whenform.samlenableis initially true, but this watcher won’t run… The password fields are hidden whenform.samlenableis initially true, but this watcher won’t run… This test validates password generation, but it asserts anINTERNAL_ERRORthat occurs only… Generating a random password whenever the client omitspasswordchanges the API semantics for all… Generating a random password whenever the client omitspasswordchanges the API semantics for all… Generating a random password whenever the client omitspasswordchanges the API semantics for all…
Review effort: Lite
| 'form.samlenable' (samlEnabled) { | ||
| // a SAML-authenticated account never logs in with a native password | ||
| this.rules.password = samlEnabled ? [] : [{ required: true, message: this.$t('message.error.required.input') }] | ||
| this.rules.confirmpassword = samlEnabled ? [] : [ | ||
| { required: true, message: this.$t('message.error.required.input') }, | ||
| { validator: this.validateConfirmPassword } | ||
| ] | ||
| } |
|
@blueorangutan package |
nvazquez
left a comment
There was a problem hiding this comment.
Code LGTM - just this minor issue: extra space is not needed
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
|
@blueorangutan package |
|
@DaanHoogland a [SL] Jenkins job has been kicked to build packages. It will be bundled with no SystemVM templates. I'll keep you posted as I make progress. |
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Copilot review overview
4 open issues
The UI logic toggles behavior based onvalues.samlenable, butsamlenableis not included in… · New The concatenated description string is missing a space between sentences, resulting in `section.If… · New This watcher won’t run on initial render, sorules.password/rules.confirmpasswordmay remain… · New This watcher updates form validation rules whenform.samlenablechanges, but it does not run on…
1 resolved since last review
Review effort: Lite
| const params = { | ||
| roleid: values.roleid, | ||
| username: values.username, | ||
| password: values.password, | ||
| email: values.email, | ||
| firstname: values.firstname, | ||
| lastname: values.lastname, | ||
| domainid: values.domainid | ||
| } | ||
| if (!values.samlenable) { | ||
| // SAML-authenticated accounts never log in with a native password; let the API | ||
| // generate one rather than asking the admin to set one that will never be used | ||
| params.password = values.password | ||
| } |
| 'form.samlenable' (samlEnabled) { | ||
| // a SAML-authenticated account never logs in with a native password | ||
| this.rules.password = samlEnabled ? [] : [{ required: true, message: this.$t('message.error.required.input') }] | ||
| this.rules.confirmpassword = samlEnabled ? [] : [ | ||
| { required: true, message: this.$t('message.error.required.input') }, | ||
| { validator: this.validateConfirmPassword } | ||
| ] | ||
| } |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Copilot review overview
8 open issues
This watcher only runs whenform.samlenablechanges; if the form loads withsamlenable === true… · New The UI logic toggles behavior based onvalues.samlenable, butsamlenableis not included in… The generated password length is a hard-coded magic number (12). To keep behavior consistent with… · New The generated password length is a hard-coded magic number (12). To keep behavior consistent with… · New The decision to omitparams.passworddepends onvalues.samlenable, but the UI… · New This watcher won’t run on initial render, sorules.password/rules.confirmpasswordmay remain… This watcher updates form validation rules whenform.samlenablechanges, but it does not run on… The test duplicates the generated password length (12), which can become brittle if the… · New
1 resolved since last review
Review effort: Lite
| 'form.samlenable' (samlEnabled) { | ||
| // a SAML-authenticated account never logs in with a native password | ||
| this.rules.password = samlEnabled ? [] : [{ required: true, message: this.$t('message.error.required.input') }] | ||
| this.rules.confirmpassword = samlEnabled ? [] : [ | ||
| { required: true, message: this.$t('message.error.required.input') }, | ||
| { validator: this.validateConfirmPassword } | ||
| ] |
| private static final int GENERATED_PASSWORD_LENGTH = 12; | ||
|
|
| if(StringUtils.isEmpty(getPassword())) { | ||
| throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Empty passwords are not allowed"); | ||
| if (getPassword() == null) { | ||
| password = PasswordGenerator.generateRandomPassword(GENERATED_PASSWORD_LENGTH); |
| const params = { | ||
| roleid: values.roleid, | ||
| username: values.username, | ||
| password: values.password, | ||
| email: values.email, | ||
| firstname: values.firstname, | ||
| lastname: values.lastname, | ||
| domainid: values.domainid | ||
| } | ||
| if (!values.samlenable) { | ||
| // SAML-authenticated accounts never log in with a native password; let the API | ||
| // generate one rather than asking the admin to set one that will never be used |
| Assert.assertEquals("a password should be generated for accounts that authenticate externally", | ||
| 12, createAccountCmd.getPassword().length()); |
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Copilot review overview
11 open issues
This watcher only runs whenform.samlenablechanges; if the form loads withsamlenable === true… The UI logic toggles behavior based onvalues.samlenable, butsamlenableis not included in… The PR description template is largely unfilled (types of change, severity, and testing sections).… · New A new i18n key is added only inen.json. If the UI ships with additional locales, users on those… · New This watcher won’t run on initial render, so ifform.samlenableis initialized totrue(e.g.,… · New The decision to omitparams.passworddepends onvalues.samlenable, but the UI… The generated password length is a hard-coded magic number (12). To keep behavior consistent with… The generated password length is a hard-coded magic number (12). To keep behavior consistent with… This watcher won’t run on initial render, sorules.password/rules.confirmpasswordmay remain… This watcher updates form validation rules whenform.samlenablechanges, but it does not run on… The test duplicates the generated password length (12), which can become brittle if the…
Review effort: Lite
| description = "Clear text password (Default hashed to SHA256SALT). If you wish to use any other hashing algorithm, you will need to write a custom authentication adapter. See Docs section." | ||
| + " If omitted, a random password is generated, e.g. for an account that will only ever authenticate externally via SAML/LDAP.") |
| "message.restart.vpc": "Please confirm that you want to restart the VPC.", | ||
| "message.restart.vpc.remark": "Please confirm that you want to restart the VPC <p><i>Remark: making a non-redundant VPC redundant will force a clean up. The Networks will not be available for a couple of minutes</i>.</p>", | ||
| "message.running.custom.action": "Running action", | ||
| "message.saml.account.no.password": "This account will authenticate via SAML SSO, so no password is needed — one will be generated automatically.", |
| 'form.samlenable' (samlEnabled) { | ||
| // a SAML-authenticated account never logs in with a native password | ||
| this.rules.password = samlEnabled ? [] : [{ required: true, message: this.$t('message.error.required.input') }] | ||
| this.rules.confirmpassword = samlEnabled ? [] : [ | ||
| { required: true, message: this.$t('message.error.required.input') }, | ||
| { validator: this.validateConfirmPassword } | ||
| ] |
|
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 19970 |
|
@blueorangutan test |
|
@DaanHoogland a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests |
|
|
[SF] Trillian test result (tid-17534)
|
|
@blueorangutan test |
|
@RosiKyu a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests |






Description
This PR...
Fixes: #12039
Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Bug Severity
Screenshots (if appropriate):
How Has This Been Tested?
How did you try to break this feature and the system with this change?