<commit_before><?php
/**
 * Passbolt ~ Open source password manager for teams
 * Copyright (c) Passbolt SARL (https://www.passbolt.com)
 *
 * Licensed under GNU Affero General Public License version 3 of the or any later version.
 * For full copyright and license information, please see the LICENSE.txt
 * Redistributions of files must retain the above copyright notice.
 *
 * @copyright Copyright (c) Passbolt SARL (https://www.passbolt.com)
 * @license   https://opensource.org/licenses/AGPL-3.0 AGPL License
 * @link      https://www.passbolt.com Passbolt(tm)
 * @since     2.0.0
 */
/**
 * Feature : Password Workspace
 *
 * - As a user I should be able to see the passwords workspace
 * - As a user I should be able to browse my passwords
 * - As a user I should be able to use the navigation filters
 * - As a user I should be able to view my password details
 * - As a user I should be able to fav/unfav
 * - As a user I should be able to search a password by keywords
 * - As a user when I filter the password workspace all passwords should be unselected
 * - As a user when I filter by keywords the password workspace the global filter "All items" should be selected
 * - As a user, I should be able to control the sidebar visibility through the sidebar button
 * - As a user, I should see a welcome message when I am on an empty password workspace
 * - As a user I should be able to sort the passwords browser by column
 * - As a user I should be able to filter my passwords by group
 * - As a user who doesn't belong to any group, I should'nt see the "Filter by group" section on the passwords workspace
 */
namespace Tests\LU\Security;

use App\Actions\GroupActionsTrait;
use App\Actions\MasterPasswordActionsTrait;
use App\Actions\PasswordActionsTrait;
use App\Actions\SetupActionsTrait;
use App\Actions\ShareActionsTrait;
use App\Actions\UserActionsTrait;
use App\Actions\WorkspaceActionsTrait;
use App\Assertions\FilterAssertionsTrait;
use App\Assertions\GroupAssertionsTrait;
use App\Assertions\MasterPasswordAssertionsTrait;
use App\Assertions\PasswordAssertionsTrait;
use App\Assertions\SecurityAssertionsTrait;
use App\Assertions\SidebarAssertionsTrait;
use App\Assertions\UserAssertionsTrait;
use App\Assertions\WorkspaceAssertionsTrait;
use App\Lib\UuidFactory;
use App\PassboltTestCase;
use Data\Fixtures\User;

class XssTest extends PassboltTestCase
{
    use FilterAssertionsTrait;
    use GroupActionsTrait;
    use GroupAssertionsTrait;
    use PasswordActionsTrait;
    use MasterPasswordActionsTrait;
    use MasterPasswordAssertionsTrait;
    use SecurityAssertionsTrait;
    use SetupActionsTrait;
    use ShareActionsTrait;
    use SidebarAssertionsTrait;
    use UserActionsTrait;
    use UserAssertionsTrait;
    use WorkspaceActionsTrait;
    use WorkspaceAssertionsTrait;
    use PasswordAssertionsTrait;

    /**
     * Scenario: As a user I should not be affected by any xss on the passwords workspace
     *
     * Given I am logged in as Xss0, and I go to the passwords workspace
     * Then  I should not see any XSS execution
     * When  I select each password one after the other
     * Then  I should not see any XSS execution
     * When  I edit each password one after the other
     * Then  I should not see any XSS execution
     * When  I share each password one after the other
     * Then  I should not see any XSS execution
     * When  I filter the workspace by group
     * Then  I should not see any XSS execution
     *
     * @group LU
     * @group password
     * @group password-workspace
     * @group security
     * @group v2
     */
    public function testPasswordsWorkspace()
    {
        // Given I am Xss0<commit_msg>PASSBOLT-2541 Remove useless dependencies, fix comment<commit_after><?php
/**
 * Passbolt ~ Open source password manager for teams
 * Copyright (c) Passbolt SARL (https://www.passbolt.com)
 *
 * Licensed under GNU Affero General Public License version 3 of the or any later version.
 * For full copyright and license information, please see the LICENSE.txt
 * Redistributions of files must retain the above copyright notice.
 *
 * @copyright Copyright (c) Passbolt SARL (https://www.passbolt.com)
 * @license   https://opensource.org/licenses/AGPL-3.0 AGPL License
 * @link      https://www.passbolt.com Passbolt(tm)
 * @since     2.0.0
 */
/**
 * Scenarios :
 * - As a user I should not be affected by any xss on the passwords workspace
 * - As a user I should not be affected by any xss on the users workspace
 * - As a user I should not be affected by any xss on the settings workspace
 */
namespace Tests\LU\Security;

use App\Actions\GroupActionsTrait;
use App\Actions\PasswordActionsTrait;
use App\Actions\ShareActionsTrait;
use App\Actions\UserActionsTrait;
use App\Actions\WorkspaceActionsTrait;
use App\Assertions\MasterPasswordAssertionsTrait;
use App\Assertions\PasswordAssertionsTrait;
use App\Assertions\SecurityAssertionsTrait;
use App\Assertions\UserAssertionsTrait;
use App\Lib\UuidFactory;
use App\PassboltTestCase;
use Data\Fixtures\User;

class XssTest extends PassboltTestCase
{
    use GroupActionsTrait;
    use MasterPasswordAssertionsTrait;
    use PasswordActionsTrait;
    use PasswordAssertionsTrait;
    use SecurityAssertionsTrait;
    use ShareActionsTrait;
    use UserActionsTrait;
    use UserAssertionsTrait;
    use WorkspaceActionsTrait;

    /**
     * Scenario: As a user I should not be affected by any xss on the passwords workspace
     *
     * Given I am logged in as Xss0, and I go to the passwords workspace
     * Then  I should not see any XSS execution
     * When  I select each password one after the other
     * Then  I should not see any XSS execution
     * When  I edit each password one after the other
     * Then  I should not see any XSS execution
     * When  I share each password one after the other
     * Then  I should not see any XSS execution
     * When  I filter the workspace by group
     * Then  I should not see any XSS execution
     *
     * @group LU
     * @group password
     * @group password-workspace
     * @group security
     * @group v2
     */
    public function testPasswordsWorkspace()
    {
        // Given I am Xss0
{'fraction_non_alphanumeric': 0.061501210653753025, 'fraction_numerical': 0.0035512510088781275, 'mean_word_length': 3.4257142857142857, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 8, 'lorem ipsum': 0, 'www.': 6, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2204362', 'n_tokens_mistral': 1765, 'n_tokens_neox': 1716, 'n_words': 722}