Language: PHP
Label: vulnerable
CWE: CWE-281 \u2014 Improper Preservation of Permissions
The product does not preserve permissions or incorrectly preserves permissions when copying, restoring, or sharing objects, which can cause them to have less restrictive permissions than intended.

Code:
    public function __construct(
        string $project_default_visibility,
        array $trove_categories,
        array $field_list,
        array $company_templates,
        array $tuleap_templates,
        array $external_templates,
    ) {
        $this->tuleap_templates             = json_encode($tuleap_templates);
        $this->are_restricted_users_allowed = (bool) ForgeConfig::areRestrictedUsersAllowed();
        $this->project_default_visibility   = $project_default_visibility;
        $this->projects_must_be_approved    = (bool) ForgeConfig::get(
            ProjectManager::CONFIG_PROJECT_APPROVAL,
            true
        );
        $this->trove_categories             = json_encode($trove_categories, JSON_THROW_ON_ERROR);
        $this->is_description_mandatory     = ProjectDescriptionUsageRetriever::isDescriptionMandatory();
        $this->field_list                   = json_encode($field_list);
        $this->company_templates            = json_encode($company_templates);
        $this->company_name                 = ForgeConfig::get('sys_org_name');
        $this->can_user_choose_privacy      = (bool) ForgeConfig::get(
            ProjectManager::SYS_USER_CAN_CHOOSE_PROJECT_PRIVACY
        );
        $this->external_templates           = json_encode($external_templates);
    }