From 4380e209f6b10af55c0401f96bc77d616490d980 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torben=20H=C3=B6hn?= Date: Sat, 2 Nov 2024 13:14:57 +0100 Subject: [PATCH 1/6] increase minimum password length --- .../User/Model/UserValidationRules.php | 6 ++-- .../Magento/TestFramework/Bootstrap.php | 6 ++-- lib/web/mage/validation.js | 8 +++--- .../Setup/Fixtures/AdminUsersFixture.php | 6 ++-- .../Command/AdminUserCreateCommandTest.php | 28 +++++++++---------- 5 files changed, 27 insertions(+), 27 deletions(-) diff --git a/app/code/Magento/User/Model/UserValidationRules.php b/app/code/Magento/User/Model/UserValidationRules.php index 2c39f66da990c..22774a363dad4 100644 --- a/app/code/Magento/User/Model/UserValidationRules.php +++ b/app/code/Magento/User/Model/UserValidationRules.php @@ -1,7 +1,7 @@ setFirstName('Firstname') ->setLastName('Lastname') ->setUserName('admin' . $i) - ->setPassword('123123q') + ->setPassword('1234512345q!') ->setIsActive(1); $adminUser->save(); } diff --git a/setup/src/Magento/Setup/Test/Unit/Console/Command/AdminUserCreateCommandTest.php b/setup/src/Magento/Setup/Test/Unit/Console/Command/AdminUserCreateCommandTest.php index d7da1c2de2cbe..b0cf7c6584a93 100644 --- a/setup/src/Magento/Setup/Test/Unit/Console/Command/AdminUserCreateCommandTest.php +++ b/setup/src/Magento/Setup/Test/Unit/Console/Command/AdminUserCreateCommandTest.php @@ -1,7 +1,7 @@ 'user', - '--' . AdminAccount::KEY_PASSWORD => '123123q', + '--' . AdminAccount::KEY_PASSWORD => '1234512345q!', '--' . AdminAccount::KEY_EMAIL => 'test@test.com', '--' . AdminAccount::KEY_FIRST_NAME => 'John', '--' . AdminAccount::KEY_LAST_NAME => 'Doe' ]; $data = [ AdminAccount::KEY_USER => 'user', - AdminAccount::KEY_PASSWORD => '123123q', + AdminAccount::KEY_PASSWORD => '1234512345q!', AdminAccount::KEY_EMAIL => 'test@test.com', AdminAccount::KEY_FIRST_NAME => 'John', AdminAccount::KEY_LAST_NAME => 'Doe', @@ -93,7 +93,7 @@ public function testInteraction(): void $this->questionHelperMock ->method('ask') - ->willReturnOnConsecutiveCalls('admin', 'Password123', 'john.doe@example.com', 'John', 'Doe'); + ->willReturnOnConsecutiveCalls('admin', 'Password1234', 'john.doe@example.com', 'John', 'Doe'); // We override the standard helper with our mock $this->command->getHelperSet()->set($this->questionHelperMock, 'question'); @@ -102,7 +102,7 @@ public function testInteraction(): void $expectedData = [ 'admin-user' => 'admin', - 'admin-password' => 'Password123', + 'admin-password' => 'Password1234', 'admin-email' => 'john.doe@example.com', 'admin-firstname' => 'John', 'admin-lastname' => 'Doe', @@ -189,38 +189,38 @@ public static function validateDataProvider(): array { return [ [ - [null, 'Doe', 'admin', 'test@test.com', '123123q', '123123q'], + [null, 'Doe', 'admin', 'test@test.com', '1234512345q!', '1234512345q!'], ['"First Name" is required. Enter and try again.'] ], [ - ['John', null, null, 'test@test.com', '123123q', '123123q'], + ['John', null, null, 'test@test.com', '1234512345q!', '1234512345q!'], ['"User Name" is required. Enter and try again.', '"Last Name" is required. Enter and try again.'], ], - [['John', 'Doe', 'admin', null, '123123q', '123123q'], ['Please enter a valid email.']], + [['John', 'Doe', 'admin', null, '1234512345q!', '1234512345q!'], ['Please enter a valid email.']], [ - ['John', 'Doe', 'admin', 'test', '123123q', '123123q'], + ['John', 'Doe', 'admin', 'test', '1234512345q!', '1234512345q!'], ["'test' is not a valid email address in the basic format local-part@hostname"] ], [ ['John', 'Doe', 'admin', 'test@test.com', '', ''], [ 'Password is required field.', - 'Your password must be at least 7 characters.', + 'Your password must be at least 12 characters.', 'Your password must include both numeric and alphabetic characters.' ] ], [ ['John', 'Doe', 'admin', 'test@test.com', '123123', '123123'], [ - 'Your password must be at least 7 characters.', + 'Your password must be at least 12 characters.', 'Your password must include both numeric and alphabetic characters.' ] ], [ - ['John', 'Doe', 'admin', 'test@test.com', '1231231', '1231231'], + ['John', 'Doe', 'admin', 'test@test.com', '123123123123', '123123123123'], ['Your password must include both numeric and alphabetic characters.'] ], - [['John', 'Doe', 'admin', 'test@test.com', '123123q', '123123q'], []], + [['John', 'Doe', 'admin', 'test@test.com', '1234512345q!', '1234512345q!'], []], ]; } } From 2c1f24ebf0832bf3581e1c532da36af39d03a82d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torben=20H=C3=B6hn?= Date: Mon, 25 Nov 2024 21:54:17 +0100 Subject: [PATCH 2/6] adjust further configs and tests --- .../Unit/Controller/Adminhtml/User/DeleteTest.php | 10 +++++----- .../config/install-config-mysql.php.dist | 6 +++--- .../integration/etc/install-config-mysql.php.dist | 6 +++--- .../testsuite/Magento/User/Model/UserTest.php | 12 ++++++------ .../etc/install-config-mysql.php.dist | 6 +++--- .../src/Magento/Setup/Fixtures/AdminUsersFixture.php | 6 +++--- .../Test/Unit/Console/Command/InstallCommandTest.php | 6 +++--- .../Setup/Test/Unit/Model/AdminAccountTest.php | 6 +++--- 8 files changed, 29 insertions(+), 29 deletions(-) diff --git a/app/code/Magento/User/Test/Unit/Controller/Adminhtml/User/DeleteTest.php b/app/code/Magento/User/Test/Unit/Controller/Adminhtml/User/DeleteTest.php index 5d2fb82d67097..a2fd4e34eb954 100644 --- a/app/code/Magento/User/Test/Unit/Controller/Adminhtml/User/DeleteTest.php +++ b/app/code/Magento/User/Test/Unit/Controller/Adminhtml/User/DeleteTest.php @@ -1,7 +1,7 @@ '123123q', + 'currentUserPassword' => '1234512345q!', 'userId' => 1, 'currentUserId' => 2, 'resultMethod' => 'addSuccess', ], [ - 'currentUserPassword' => '123123q', + 'currentUserPassword' => '1234512345q!', 'userId' => 0, 'currentUserId' => 2, 'resultMethod' => 'addError', ], [ - 'currentUserPassword' => '123123q', + 'currentUserPassword' => '1234512345q!', 'userId' => 1, 'currentUserId' => 1, 'resultMethod' => 'addError', diff --git a/dev/tests/api-functional/config/install-config-mysql.php.dist b/dev/tests/api-functional/config/install-config-mysql.php.dist index abff693cb15ad..2d72df1f7dc14 100644 --- a/dev/tests/api-functional/config/install-config-mysql.php.dist +++ b/dev/tests/api-functional/config/install-config-mysql.php.dist @@ -2,8 +2,8 @@ /** * Magento console installer options for Web API functional tests. Are used in functional tests bootstrap. * - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2015 Adobe + * All Rights Reserved. */ return [ 'language' => 'en_US', @@ -21,7 +21,7 @@ return [ 'admin-firstname' => 'Admin', 'admin-email' => 'admin@example.com', 'admin-user' => 'admin', - 'admin-password' => '123123q', + 'admin-password' => '1234512345q!', 'admin-use-security-key' => '0', /* PayPal has limitation for order number - 20 characters. 10 digits prefix + 8 digits number is good enough */ 'sales-order-increment-prefix' => time(), diff --git a/dev/tests/integration/etc/install-config-mysql.php.dist b/dev/tests/integration/etc/install-config-mysql.php.dist index 1f6399bc6b4dc..06af87b2e1769 100644 --- a/dev/tests/integration/etc/install-config-mysql.php.dist +++ b/dev/tests/integration/etc/install-config-mysql.php.dist @@ -1,13 +1,13 @@ 'localhost', 'db-user' => 'root', - 'db-password' => '123123q', + 'db-password' => '1234512345q!', 'db-name' => 'magento_integration_tests', 'db-prefix' => '', 'backend-frontname' => 'backend', diff --git a/dev/tests/integration/testsuite/Magento/User/Model/UserTest.php b/dev/tests/integration/testsuite/Magento/User/Model/UserTest.php index 5c4c4db2a048a..784a8be369533 100644 --- a/dev/tests/integration/testsuite/Magento/User/Model/UserTest.php +++ b/dev/tests/integration/testsuite/Magento/User/Model/UserTest.php @@ -1,7 +1,7 @@ setEmail( 'jdoe@example.com' )->setPassword( - '123123q' + '1234512345q!' ); $this->_model->save(); $this->assertStringNotContainsString( - '123123q', + '1234512345q!', $this->_model->getPassword(), 'Password is expected to be hashed' ); @@ -486,9 +486,9 @@ public function testBeforeSaveValidationSuccess() )->setEmail( 'jdoe@example.com' )->setPassword( - '1234abc' + '1234512345q!' )->setPasswordConfirmation( - '1234abc' + '1234512345q!' ); $this->_model->save(); } diff --git a/dev/tests/setup-integration/etc/install-config-mysql.php.dist b/dev/tests/setup-integration/etc/install-config-mysql.php.dist index 5dea43f9fa583..0f854cfe2c9e4 100644 --- a/dev/tests/setup-integration/etc/install-config-mysql.php.dist +++ b/dev/tests/setup-integration/etc/install-config-mysql.php.dist @@ -1,7 +1,7 @@ '', 'backend-frontname' => 'admin', 'admin-user' => 'admin', - 'admin-password' => '123123q', + 'admin-password' => '1234512345q!', 'admin-email' => \Magento\TestFramework\Bootstrap::ADMIN_EMAIL, 'admin-firstname' => \Magento\TestFramework\Bootstrap::ADMIN_FIRSTNAME, 'admin-lastname' => \Magento\TestFramework\Bootstrap::ADMIN_LASTNAME, diff --git a/setup/src/Magento/Setup/Fixtures/AdminUsersFixture.php b/setup/src/Magento/Setup/Fixtures/AdminUsersFixture.php index 62f3423c989e0..4065c91b94f14 100644 --- a/setup/src/Magento/Setup/Fixtures/AdminUsersFixture.php +++ b/setup/src/Magento/Setup/Fixtures/AdminUsersFixture.php @@ -78,7 +78,7 @@ public function __construct( } /** - * {@inheritdoc} + * @inheritdoc */ public function execute() { @@ -105,7 +105,7 @@ public function execute() } /** - * {@inheritdoc} + * @inheritdoc */ public function getActionTitle() { @@ -113,7 +113,7 @@ public function getActionTitle() } /** - * {@inheritdoc} + * @inheritdoc */ public function introduceParamLabels() { diff --git a/setup/src/Magento/Setup/Test/Unit/Console/Command/InstallCommandTest.php b/setup/src/Magento/Setup/Test/Unit/Console/Command/InstallCommandTest.php index 04f11505331b7..8cd36aa12bd01 100644 --- a/setup/src/Magento/Setup/Test/Unit/Console/Command/InstallCommandTest.php +++ b/setup/src/Magento/Setup/Test/Unit/Console/Command/InstallCommandTest.php @@ -1,7 +1,7 @@ input['--' . AdminAccount::KEY_USER] = 'user'; - $this->input['--' . AdminAccount::KEY_PASSWORD] = '123123q'; + $this->input['--' . AdminAccount::KEY_PASSWORD] = '1234512345q!'; $this->input['--' . AdminAccount::KEY_EMAIL] = 'test@test.com'; $this->input['--' . AdminAccount::KEY_FIRST_NAME] = 'John'; $this->input['--' . AdminAccount::KEY_LAST_NAME] = 'Doe'; diff --git a/setup/src/Magento/Setup/Test/Unit/Model/AdminAccountTest.php b/setup/src/Magento/Setup/Test/Unit/Model/AdminAccountTest.php index e11c58846cc67..dc1db5fad3a32 100644 --- a/setup/src/Magento/Setup/Test/Unit/Model/AdminAccountTest.php +++ b/setup/src/Magento/Setup/Test/Unit/Model/AdminAccountTest.php @@ -1,7 +1,7 @@ 'John', AdminAccount::KEY_LAST_NAME => 'Doe', AdminAccount::KEY_EMAIL => 'john.doe@test.com', - AdminAccount::KEY_PASSWORD => '123123q', + AdminAccount::KEY_PASSWORD => '1234512345q!', AdminAccount::KEY_USER => 'admin', AdminAccount::KEY_PREFIX => 'pre_' ]; From 2e1d562fe1ef71e2ad3a0f2bc026786cc976febc Mon Sep 17 00:00:00 2001 From: glo24157 Date: Wed, 29 Jan 2025 20:35:17 +0530 Subject: [PATCH 3/6] Fix functional test failures --- .../Magento/User/Test/Mftf/Data/UserData.xml | 40 +++++++++---------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/app/code/Magento/User/Test/Mftf/Data/UserData.xml b/app/code/Magento/User/Test/Mftf/Data/UserData.xml index d221a5e674d1b..2b0453df7f132 100644 --- a/app/code/Magento/User/Test/Mftf/Data/UserData.xml +++ b/app/code/Magento/User/Test/Mftf/Data/UserData.xml @@ -21,8 +21,8 @@ John Doe admin@example.com - 123123q - 123123q + 1234512345q! + 1234512345q! en_US English (United States) true @@ -44,8 +44,8 @@ John Doe admin@example.com - 123123QA - 123123QA + 1234512345q! + 1234512345q! en_US English (United States) true @@ -61,8 +61,8 @@ John Doe admin@example.com - 123123q - 123123q + 1234512345q! + 1234512345q! en_US English (United States) true @@ -78,8 +78,8 @@ John Doe admin@example.com - 123123QA - 123123QA + 1234512345q! + 1234512345q! en_US English (United States) true @@ -105,8 +105,8 @@ admin3 admin3 admin3WebUser@example.com - 123123q - 123123q + 1234512345q! + 1234512345q! en_US true 123123q @@ -129,8 +129,8 @@ John Doe admin@example.com - 123123q - 123123q + 1234512345q! + 1234512345q! en_US English (United States) true @@ -150,8 +150,8 @@ FirstName LastName admin@example.com - 123123q - 123123q + 1234512345q! + 1234512345q! en_US English (United States) {{_ENV.MAGENTO_ADMIN_PASSWORD}} @@ -166,8 +166,8 @@ FirstName LastName admin@example.com - 123123q - 123123q + 1234512345q! + 1234512345q! en_US English (United States) {{_ENV.MAGENTO_ADMIN_PASSWORD}} @@ -188,8 +188,8 @@ John Doe admin@example.com - 123123QA - 123123QA + 1234512345q! + 1234512345q! {{_ENV.MAGENTO_ADMIN_PASSWORD}} Administrators @@ -201,8 +201,8 @@ John Doe admin@example.com - 123123UPD - 123123UPD + 1234512345q! + 1234512345q! {{_ENV.MAGENTO_ADMIN_PASSWORD}} 1 From 934054d6b2ec89a748d19821e6907f61dc4ef12a Mon Sep 17 00:00:00 2001 From: engcom-Hotel Date: Thu, 30 Jan 2025 12:49:46 +0530 Subject: [PATCH 4/6] Fix functional tests failures --- .../Mftf/ActionGroup/AdminResetPasswordActionGroup.xml | 2 +- .../AdminResetPasswordUsingOldPasswordActionGroup.xml | 8 ++++---- .../AdminOldPasswordRequiredToResetAdminPasswordTest.xml | 2 +- app/code/Magento/User/Test/Mftf/Data/UserData.xml | 6 +++--- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/app/code/Magento/Security/Test/Mftf/ActionGroup/AdminResetPasswordActionGroup.xml b/app/code/Magento/Security/Test/Mftf/ActionGroup/AdminResetPasswordActionGroup.xml index 6f6cb89d1bc64..d7bba5e4bb8a3 100644 --- a/app/code/Magento/Security/Test/Mftf/ActionGroup/AdminResetPasswordActionGroup.xml +++ b/app/code/Magento/Security/Test/Mftf/ActionGroup/AdminResetPasswordActionGroup.xml @@ -25,7 +25,7 @@ - + diff --git a/app/code/Magento/Security/Test/Mftf/ActionGroup/AdminResetPasswordUsingOldPasswordActionGroup.xml b/app/code/Magento/Security/Test/Mftf/ActionGroup/AdminResetPasswordUsingOldPasswordActionGroup.xml index eb89154aaa39a..be5240b33b0d8 100644 --- a/app/code/Magento/Security/Test/Mftf/ActionGroup/AdminResetPasswordUsingOldPasswordActionGroup.xml +++ b/app/code/Magento/Security/Test/Mftf/ActionGroup/AdminResetPasswordUsingOldPasswordActionGroup.xml @@ -12,8 +12,8 @@ Reset password using old password on All Users page. - - + + @@ -22,8 +22,8 @@ - - + + diff --git a/app/code/Magento/Security/Test/Mftf/Test/AdminOldPasswordRequiredToResetAdminPasswordTest.xml b/app/code/Magento/Security/Test/Mftf/Test/AdminOldPasswordRequiredToResetAdminPasswordTest.xml index 821844a31c6ef..da3ddb19bb206 100644 --- a/app/code/Magento/Security/Test/Mftf/Test/AdminOldPasswordRequiredToResetAdminPasswordTest.xml +++ b/app/code/Magento/Security/Test/Mftf/Test/AdminOldPasswordRequiredToResetAdminPasswordTest.xml @@ -40,7 +40,7 @@ - + diff --git a/app/code/Magento/User/Test/Mftf/Data/UserData.xml b/app/code/Magento/User/Test/Mftf/Data/UserData.xml index 2b0453df7f132..81756ac84a348 100644 --- a/app/code/Magento/User/Test/Mftf/Data/UserData.xml +++ b/app/code/Magento/User/Test/Mftf/Data/UserData.xml @@ -34,8 +34,8 @@ - 123123qA - 123123qA + 123123qA1234 + 123123qA1234 {{roleSales.rolename}} @@ -98,7 +98,7 @@ admin John Smith - admin123 + admin@123456 admin3 From c52a55c7d22252fffe8f33f4369d4fd618fd56a1 Mon Sep 17 00:00:00 2001 From: engcom-Hotel Date: Thu, 30 Jan 2025 12:54:23 +0530 Subject: [PATCH 5/6] AC-13826: Increase minimum password length for admin user - Added copywrite information --- .../AdminResetPasswordUsingOldPasswordActionGroup.xml | 4 ++-- .../Test/AdminOldPasswordRequiredToResetAdminPasswordTest.xml | 4 ++-- app/code/Magento/User/Test/Mftf/Data/UserData.xml | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/code/Magento/Security/Test/Mftf/ActionGroup/AdminResetPasswordUsingOldPasswordActionGroup.xml b/app/code/Magento/Security/Test/Mftf/ActionGroup/AdminResetPasswordUsingOldPasswordActionGroup.xml index be5240b33b0d8..a7e2d17b8010b 100644 --- a/app/code/Magento/Security/Test/Mftf/ActionGroup/AdminResetPasswordUsingOldPasswordActionGroup.xml +++ b/app/code/Magento/Security/Test/Mftf/ActionGroup/AdminResetPasswordUsingOldPasswordActionGroup.xml @@ -1,8 +1,8 @@ diff --git a/app/code/Magento/Security/Test/Mftf/Test/AdminOldPasswordRequiredToResetAdminPasswordTest.xml b/app/code/Magento/Security/Test/Mftf/Test/AdminOldPasswordRequiredToResetAdminPasswordTest.xml index da3ddb19bb206..015c96abe2c02 100644 --- a/app/code/Magento/Security/Test/Mftf/Test/AdminOldPasswordRequiredToResetAdminPasswordTest.xml +++ b/app/code/Magento/Security/Test/Mftf/Test/AdminOldPasswordRequiredToResetAdminPasswordTest.xml @@ -1,8 +1,8 @@ diff --git a/app/code/Magento/User/Test/Mftf/Data/UserData.xml b/app/code/Magento/User/Test/Mftf/Data/UserData.xml index 81756ac84a348..6b9ce0b280a04 100644 --- a/app/code/Magento/User/Test/Mftf/Data/UserData.xml +++ b/app/code/Magento/User/Test/Mftf/Data/UserData.xml @@ -1,8 +1,8 @@ From 275896fd97ab1eb774d1bd557cf3102dbec42060 Mon Sep 17 00:00:00 2001 From: engcom-Charlie Date: Fri, 21 Feb 2025 15:47:51 +0530 Subject: [PATCH 6/6] Fixed unit test failure --- dev/tests/js/jasmine/tests/lib/mage/validation.test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/tests/js/jasmine/tests/lib/mage/validation.test.js b/dev/tests/js/jasmine/tests/lib/mage/validation.test.js index 3b3657568af3c..f968cbe2db9c0 100644 --- a/dev/tests/js/jasmine/tests/lib/mage/validation.test.js +++ b/dev/tests/js/jasmine/tests/lib/mage/validation.test.js @@ -413,7 +413,7 @@ define([ expect($.validator.methods['validate-admin-password'] .call($.validator.prototype, ' ')).toEqual(true); expect($.validator.methods['validate-admin-password'] - .call($.validator.prototype, '123@123.com')).toEqual(true); + .call($.validator.prototype, '1234@123.com')).toEqual(true); expect($.validator.methods['validate-admin-password'] .call($.validator.prototype, 'abc')).toEqual(false); expect($.validator.methods['validate-admin-password']