Skip to content
This repository has been archived by the owner on Dec 13, 2022. It is now read-only.

Commit

Permalink
Merge release-22.04.3 into 22.04.x (#11623)
Browse files Browse the repository at this point in the history
* fix(git): resync 22.04.x to dev-22.04.x (#11503)

* [SNYK] Sanitize and bind ACL host dependency queries (#11389) (#11394)

* Sanitize and bind ACL host dependency queries

* fix issues

* removed old variable userCrypted and the use of it (#11334) (#11352)

Co-authored-by: jeremyjaouen <[email protected]>

* enh(Header/userMenu):reduce spacing user menu (#11393)

* update user menu

* fix(hostgroup): fix display of hostgroups in select2 (#11431) (#11443)

* fix(ci): fix debian packaging with freshly instanciated jenkins slave (#11398) (#11399)

Refs: MON-14377

* Sanitized and bound queries (#11413) (#11445)

lines : 130 -142

* Snyk: Sanitize and bind media sync queries 22.04.x (#11418)

* sanitizing and binding sync dir file queries

* Applying some fixes

* Snyk: Sanitize and bind ACL service dependency queries dev-22.04.x (#11395)

* Snyk: Sanitize and bind Auth class queries 22.04.x (#11448)

* [Backport/need review] fix(UI): Fix layout for Safari and form validation (#11440)

* fix(UI): Fix layout for Safari and form validation (#11373)

* Fix form validation

* Fix padlock layout for safari

* Update centreon-frontend

* Remove debug variable

* Fix test

* Fix page respsoniveness

* Rename variable

* update deps

* Fix package-lock

* Fix package-lock

* Add debug statement for debian

* Install nodejs rather npm

* Attempt fix

* Attempt to fix nodejs installation

* add sudo

* Fix redoc-cli usage

* Try to fix permission on npm

* Fix

* Fix permission

* Fix permission (please work)

* Fix source

* Stop using npx because.....

* Allow legacy-peer-deps

* Remove nodejs installation

* Fix image to pull for debian 11

* [SNYK] Sanitize and bind centreonGraph class queries (#11409) (#11421)

1122

1153

1134

* [Snyk] Sanitize and bind ACL action access queries (#11385) (#11402)

* Sanitize and bind ACL action access queries

_ sanitize if possible each variables inserted in a query

_ use PDO prepared statement and bind() method

_ Do not use $pearDB->escape on which is for examples useless on integers and on non closed HTML tags (svg, img, etc)

* fix line length

* fix failed checks

* feat(api): implement endpoint to update centreon web (#11391) (#11401)

Refs: MON-12296

* Clean(platform): Clean appKey method and usage 22.04.x (#11452)

* Clean(platform): Clean appKey method and usage (#11336)

* removing appKey from information table in baseConf and 22.10 update script

* removing appKey from NotifyMasterService.php

* removing appKey from CentreonRemoteServer.php

* applying suggested changes

* Applying suggested changes

Co-authored-by: Kevin Duret <[email protected]>

* adding 22.04.2 update script file with changes

* revert 22.04 beta 1 script to its original

Co-authored-by: Kevin Duret <[email protected]>

* enh(platform): Use API to select metrics in virtual metrics configuration form 22.04.x (#11461)

* changing select with select2 of metrics

* fix alignement

* remove unecessary files and replace selec by select2 in formComponentTemplate

* fix select id name for acceptance tests

* update composer for acceptance tests

* fix acceptance test 2

* add allow clear to metrics select2

* applying suggested changes

* final changes for merging

* remove unecessary select tag

* [SNYK] Sanitize and bind ACL class queries (#11392) (#11472)

* Sanitize and bind ACL class queries

Queries   sanitized  and bound using PDO statement

* fix spaces

spaces between (int) cast and variables

* update file delete spaces after comma

* change variables names due to a review

* Line exceeds 120 characters; contains 123 characters

* fix(conf) fix broker conf name display in listing (#11372) (#11376)

Co-authored-by: Elmahdi ABBASSI <[email protected]>
Co-authored-by: jeremyjaouen <[email protected]>
Co-authored-by: Nouha-ElAbrouki <[email protected]>
Co-authored-by: Kevin Duret <[email protected]>
Co-authored-by: hyahiaoui-ext <[email protected]>
Co-authored-by: Tom Darneix <[email protected]>
Co-authored-by: alaunois <[email protected]>

* fix(cron): Escape database name in CentACL 22.04.x (#11510)

* fix(test): wait 8s before checking downtime is active in rest api v1 test (#11498) (#11504)

Refs: MON-14585

* fix(UI): Include host_id when selecting ServiceGroups on dashreports (#11428) (#11519)

Co-authored-by: VHS <[email protected]>

Co-authored-by: VHS <[email protected]>

* fix(Resources/Graph): export graph image after selecting png (#11491)

* [SNYK] Sanitize and bind ACL host dependency queries (#11389) (#11394)

* Sanitize and bind ACL host dependency queries

* fix issues

* removed old variable userCrypted and the use of it (#11334) (#11352)

Co-authored-by: jeremyjaouen <[email protected]>

* enh(Header/userMenu):reduce spacing user menu (#11393)

* update user menu

* fix(hostgroup): fix display of hostgroups in select2 (#11431) (#11443)

* fix(ci): fix debian packaging with freshly instanciated jenkins slave (#11398) (#11399)

Refs: MON-14377

* Sanitized and bound queries (#11413) (#11445)

lines : 130 -142

* Snyk: Sanitize and bind media sync queries 22.04.x (#11418)

* sanitizing and binding sync dir file queries

* Applying some fixes

* Snyk: Sanitize and bind ACL service dependency queries dev-22.04.x (#11395)

* Snyk: Sanitize and bind Auth class queries 22.04.x (#11448)

* [Backport/need review] fix(UI): Fix layout for Safari and form validation (#11440)

* fix(UI): Fix layout for Safari and form validation (#11373)

* Fix form validation

* Fix padlock layout for safari

* Update centreon-frontend

* Remove debug variable

* Fix test

* Fix page respsoniveness

* Rename variable

* update deps

* Fix package-lock

* Fix package-lock

* Add debug statement for debian

* Install nodejs rather npm

* Attempt fix

* Attempt to fix nodejs installation

* add sudo

* Fix redoc-cli usage

* Try to fix permission on npm

* Fix

* Fix permission

* Fix permission (please work)

* Fix source

* Stop using npx because.....

* Allow legacy-peer-deps

* Remove nodejs installation

* Fix image to pull for debian 11

* [SNYK] Sanitize and bind centreonGraph class queries (#11409) (#11421)

1122

1153

1134

* [Snyk] Sanitize and bind ACL action access queries (#11385) (#11402)

* Sanitize and bind ACL action access queries

_ sanitize if possible each variables inserted in a query

_ use PDO prepared statement and bind() method

_ Do not use $pearDB->escape on which is for examples useless on integers and on non closed HTML tags (svg, img, etc)

* fix line length

* fix failed checks

* feat(api): implement endpoint to update centreon web (#11391) (#11401)

Refs: MON-12296

* Clean(platform): Clean appKey method and usage 22.04.x (#11452)

* Clean(platform): Clean appKey method and usage (#11336)

* removing appKey from information table in baseConf and 22.10 update script

* removing appKey from NotifyMasterService.php

* removing appKey from CentreonRemoteServer.php

* applying suggested changes

* Applying suggested changes

Co-authored-by: Kevin Duret <[email protected]>

* adding 22.04.2 update script file with changes

* revert 22.04 beta 1 script to its original

Co-authored-by: Kevin Duret <[email protected]>

* enh(platform): Use API to select metrics in virtual metrics configuration form 22.04.x (#11461)

* changing select with select2 of metrics

* fix alignement

* remove unecessary files and replace selec by select2 in formComponentTemplate

* fix select id name for acceptance tests

* update composer for acceptance tests

* fix acceptance test 2

* add allow clear to metrics select2

* applying suggested changes

* final changes for merging

* remove unecessary select tag

* [SNYK] Sanitize and bind ACL class queries (#11392) (#11472)

* Sanitize and bind ACL class queries

Queries   sanitized  and bound using PDO statement

* fix spaces

spaces between (int) cast and variables

* update file delete spaces after comma

* change variables names due to a review

* Line exceeds 120 characters; contains 123 characters

* fix(conf) fix broker conf name display in listing (#11372) (#11376)

* fix export graph image after selecting png

Co-authored-by: Elmahdi ABBASSI <[email protected]>
Co-authored-by: jeremyjaouen <[email protected]>
Co-authored-by: Kevin Duret <[email protected]>
Co-authored-by: hyahiaoui-ext <[email protected]>
Co-authored-by: Tom Darneix <[email protected]>
Co-authored-by: alaunois <[email protected]>

* Fix(platform): Removing appkey key (#11511)

* fix(trap): Removal of the restriction on the uniqueness of the OID of a trap (#11327)

Currently, an error appears when we try to save an existing trap because a test is performed on the uniqueness of the OID.
This PR aims to remove the restriction on the uniqueness of the OID of a trap.

* fix(pendo): correctly set locale when language is detection by browser (#11484) (#11528)

* fix(test): fix random fails on virtual metric test (#11523)

Refs: MON-14359

* fix(autoload): Add classmap to fix autoload with legacy classes (#11492) (#11532)

Refs: MON-14496

* fix(ldap): small refacto of ldap authentication and log failures (#11422) (#11534)

Refs: MON-7417

* fix(api): allow api platform updates from installed 22.04.0 (#11495) (#11533)

Refs: MON-12296

* fix(api): fix call to api on fresh install (#11536) (#11537)

Refs: MON-12296

* doc(ack): acknowledge Hakaï security (#11540)

* fix(api): do not init db connection in event subscriber (#11543) (#11545)

Refs: MON-12296

* fix(web): fix the comment deletion for host monitored by poller (#11138) (#11556)

Refs: MON-12828

Co-authored-by: Stéphane Duret <[email protected]>

* SNYK: Sanitize and bind ACL actions queries (#11547)

* sanitizing and binding acl actions queries

* fix missing bind

* SNYK: Sanitize and bind Broker listing queries (#11550)

* Sanitizing and binding broker listing queries

* applying suggested changes

* fix(conf) fix encoding in template service listing (#11558) (#11564)

* fix encoding

* remove useless function

* SNYK: Sanitize and bind generateImage queries (#11561)

* sanitize and bind generate image queries

* adding throw exception

* applying suggested changes

* Update www/include/views/graphs/generateGraphs/generateImage.php

Co-authored-by: Kevin Duret <[email protected]>

Co-authored-by: Kevin Duret <[email protected]>

* MON-14501 - sanitize query in centreonXmlbgRequest class (#11570)

* sanitize query in centreonXmlbgRequest class

* add closeCursor func to resolve conv

* SNYK: Sanitize and bind Meta-Services dependency queries  (#11567)

* sanityze 2 insert queries

* spaces removed in a query

* chore(install):Update version to 22.04.3

* fix(sql): fix query to select contact during ldap import (#11578)

Refs: MON-14263

* fix(UI): Fix layout for Safari and form validation (#11373) (#11604)

* Fix form validation

* Fix padlock layout for safari

* Update centreon-frontend

* Remove debug variable

* Fix test

* Fix page respsoniveness

* Rename variable

* update deps

* Fix package-lock

Co-authored-by: Elmahdi ABBASSI <[email protected]>
Co-authored-by: jeremyjaouen <[email protected]>
Co-authored-by: Nouha-ElAbrouki <[email protected]>
Co-authored-by: Kevin Duret <[email protected]>
Co-authored-by: hyahiaoui-ext <[email protected]>
Co-authored-by: Tom Darneix <[email protected]>
Co-authored-by: alaunois <[email protected]>
Co-authored-by: VHS <[email protected]>
Co-authored-by: Laurent Calvet <[email protected]>
Co-authored-by: Stéphane Chapron <[email protected]>
Co-authored-by: Stéphane Duret <[email protected]>
  • Loading branch information
12 people authored Aug 25, 2022
1 parent cee5d3b commit 4de8b7d
Show file tree
Hide file tree
Showing 117 changed files with 3,690 additions and 1,284 deletions.
2 changes: 1 addition & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ try {
checkout scm
}
sh 'rm -rf *.deb'
sh 'docker run -i --entrypoint /src/centreon/ci/scripts/centreon-deb-package.sh -w "/src" -v "$PWD:/src" -e DISTRIB="bullseye" -e VERSION=$VERSION -e RELEASE=$RELEASE registry.centreon.com/centreon-debian11-dependencies:22.04'
sh 'docker run -i --entrypoint /src/centreon/ci/scripts/centreon-deb-package.sh -w "/src" -v "$PWD:/src" -e DISTRIB="bullseye" -e VERSION=$VERSION -e RELEASE=$RELEASE registry.centreon.com/mon-build-dependencies-22.04:debian11'
stash name: 'Debian11', includes: '*.deb'
archiveArtifacts artifacts: "*"
sh 'rm -rf *.deb'
Expand Down
1 change: 1 addition & 0 deletions SECURITY_ACK.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Centreon reserves the right to make final decisions regarding publishing acknowl

<h3> 2022 </h3>

* 2022/05/23 - Lucas Carmo and Daniel França Lima from [Hakaï Security](https://www.hakaioffensivesecurity.com/)
* 2022/02/16 - Anonymous working with Trend Micro Zero Day Initiative

<h3> 2021 </h3>
Expand Down
2 changes: 1 addition & 1 deletion ci/debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ override_dh_clean:

override_dh_auto_build:
composer install --no-dev --optimize-autoloader -n
npm ci
npm ci --legacy-peer-deps
npm run build
find . -type f | \
grep -v debian/extra/centreon-web/centreon-macroreplacement.txt | \
Expand Down
5 changes: 2 additions & 3 deletions ci/scripts/centreon-deb-package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,8 @@ done
rm -rf lang

# Generate API documentation.
apt install -y npm && sleep 30
npm install -g redoc-cli
/usr/local/bin/redoc-cli bundle --options.hideDownloadButton=true doc/API/centreon-api-v${MAJOR_VERSION}.yaml -o ../centreon-api-v${MAJOR_VERSION}.html
npm i -g redoc-cli
redoc-cli build --options.hideDownloadButton=true doc/API/centreon-api-v${MAJOR_VERSION}.yaml -o ../centreon-api-v${MAJOR_VERSION}.html

# Make tar with original content
cd ..
Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
"symfony/framework-bundle": "5.4.*",
"symfony/http-client": "5.4.*",
"symfony/http-kernel": "5.4.*",
"symfony/lock": "5.4.*",
"symfony/maker-bundle": "^1.11",
"symfony/monolog-bundle": "^3.7",
"symfony/options-resolver": "5.4.*",
Expand All @@ -85,7 +86,7 @@
"Tests\\": "tests/php/",
"Centreon\\Test\\Api\\": "tests/api/"
},
"classmap": ["www/class/"],
"classmap": ["www/class/", "lib/Centreon"],
"files" : [
"GPL_LIB/smarty-plugins/function.eval.php",
"www/api/exceptions.php",
Expand Down
91 changes: 85 additions & 6 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 40 additions & 0 deletions config/packages/Centreon.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,42 @@ services:
class: Core\Infrastructure\Platform\Repository\FileReadPlatformRepository
arguments: ['%centreon_etc_path%', '%centreon_install_path%']

Core\Platform\Application\Validator\RequirementValidatorsInterface:
class: Core\Platform\Infrastructure\Validator\RequirementValidators
arguments:
$requirementValidators: !tagged_iterator 'platform.requirement.validators'

Core\Platform\Infrastructure\Validator\RequirementValidators\DatabaseRequirementValidator:
arguments:
$dbRequirementValidators: !tagged_iterator 'platform.requirement.database.validators'

Core\Platform\Infrastructure\Validator\RequirementValidators\PhpRequirementValidator:
arguments:
$requiredPhpVersion: '%required_php_version%'

Core\Platform\Infrastructure\Validator\RequirementValidators\DatabaseRequirementValidators\MariaDbRequirementValidator:
arguments:
$requiredMariaDbMinVersion: '%required_mariadb_min_version%'

Core\Platform\Application\Repository\ReadVersionRepositoryInterface:
class: Core\Platform\Infrastructure\Repository\DbReadVersionRepository
public: true

Core\Platform\Application\Repository\ReadUpdateRepositoryInterface:
class: Core\Platform\Infrastructure\Repository\FsReadUpdateRepository
arguments:
$installDir: '%centreon_install_path%'
public: true

Core\Platform\Application\Repository\UpdateLockerRepositoryInterface:
class: Core\Platform\Infrastructure\Repository\SymfonyUpdateLockerRepository
public: true

Core\Platform\Application\Repository\WriteUpdateRepositoryInterface:
class: Core\Platform\Infrastructure\Repository\DbWriteUpdateRepository
arguments: ['%centreon_var_lib%', '%centreon_install_path%']
public: true

# Monitoring resources
_instanceof:
Centreon\Infrastructure\Monitoring\Resource\Provider\ProviderInterface:
Expand All @@ -238,6 +274,10 @@ services:
tags: ['authentication.provider.responses']
Core\Security\Infrastructure\Api\FindProviderConfigurations\ProviderPresenter\ProviderPresenterInterface:
tags: ['authentication.provider.presenters']
Core\Platform\Application\Validator\RequirementValidatorInterface:
tags: ['platform.requirement.validators']
Core\Platform\Infrastructure\Validator\RequirementValidators\DatabaseRequirementValidatorInterface:
tags: ['platform.requirement.database.validators']

Centreon\Domain\Monitoring\Interfaces\ResourceRepositoryInterface:
factory: ['@Centreon\Infrastructure\Monitoring\Resource\ResourceRepositoryFactory', 'createResourceRepository']
Expand Down
6 changes: 6 additions & 0 deletions config/routes/Centreon/platform.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ centreon_application_platform_getversion:
controller: 'Centreon\Application\Controller\PlatformController::getVersions'
condition: "request.attributes.get('version') >= 21.10"

centreon_application_platform_updateversions:
methods: PATCH
path: /platform/updates
controller: 'Core\Platform\Infrastructure\Api\UpdateVersions\UpdateVersionsController'
condition: "request.attributes.get('version') >= 22.04"

centreon_application_platformtopology_addplatformtotopology:
methods: POST
path: /platform/topology
Expand Down
5 changes: 5 additions & 0 deletions config/services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ parameters:
media_path: "img/media"
redirect_default_page: "/monitoring/resources"
session_expiration_delay: 120
required_php_version: "%env(_CENTREON_PHP_VERSION_)%"
required_mariadb_min_version: "%env(_CENTREON_MARIA_DB_MIN_VERSION_)%"

services:
# Default configuration for services in *this* file
Expand Down Expand Up @@ -66,6 +68,9 @@ services:
decorates: router
arguments: ['@.inner']

Symfony\Component\Finder\Finder:
shared: false


# Security
Security\Domain\Authentication\Interfaces\AuthenticationRepositoryInterface:
Expand Down
10 changes: 5 additions & 5 deletions cron/centAcl.php
Original file line number Diff line number Diff line change
Expand Up @@ -172,15 +172,15 @@
* Remove data from old groups (deleted groups)
*/
$aclGroupToDelete = "SELECT DISTINCT acl_group_id
FROM " . $centreonDbName . ".acl_groups WHERE acl_group_activate = '1'";
$aclGroupToDelete2 = "SELECT DISTINCT acl_group_id FROM " . $centreonDbName . ".acl_res_group_relations";
$pearDB->beginTransaction();
FROM `" . $centreonDbName . "`.acl_groups WHERE acl_group_activate = '1'";
$aclGroupToDelete2 = "SELECT DISTINCT acl_group_id FROM `" . $centreonDbName . "`.acl_res_group_relations";
$pearDBO->beginTransaction();
try {
$pearDBO->query("DELETE FROM centreon_acl WHERE group_id NOT IN (" . $aclGroupToDelete . ")");
$pearDBO->query("DELETE FROM centreon_acl WHERE group_id NOT IN (" . $aclGroupToDelete2 . ")");
$pearDB->commit();
$pearDBO->commit();
} catch (\PDOException $e) {
$pearDB->rollBack();
$pearDBO->rollBack();
$centreonLog->insertLog(
2,
"CentACL CRON: failed to delete old groups relations"
Expand Down
4 changes: 3 additions & 1 deletion doc/API/centreon-api-v22.04.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3528,6 +3528,8 @@ paths:
moduleName:
type: object
$ref: '#/components/schemas/Platform.Versions'
/platform/updates:
$ref: "./v22.04/Administration/updates.yaml"
/platform/installation/status:
get:
tags:
Expand All @@ -3541,7 +3543,7 @@ paths:
application/json:
schema:
type: object
required: ["installed_version", "has_upgrade_available"]
required: ["is_installed", "has_upgrade_available"]
properties:
is_installed:
type: boolean
Expand Down
30 changes: 30 additions & 0 deletions doc/API/v22.04/Administration/updates.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
patch:
tags:
- Platform
summary: "Update Centreon web"
description: |
Update Centreon web component
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
components:
type: array
items:
type: object
properties:
name:
type: string
enum: [ centreon-web ]
responses:
204:
description: "Platform updated"
404:
description: "Updates not found"
500:
$ref: "../../centreon-api-v22.04.yaml#/components/responses/InternalServerError"
...
6 changes: 3 additions & 3 deletions features/VirtualMetricHandle.feature
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@ Feature: Virtual Metric Handle

Background:
Given I am logged in a Centreon server with configured metrics

Scenario: Create a virtual metric
When I add a virtual metric
Then all properties are saved

Scenario: Duplicate a virtual metric
Given an existing virtual metric
When I duplicate a virtual metric
Then all properties are copied except the name

Scenario: Delete a virtual metric
Given an existing virtual metric
When I delete a virtual metric
Expand Down
3 changes: 2 additions & 1 deletion features/bootstrap/VirtualMetricHandleContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ public function iAddAVirtualMetric()
$this->page = new MetricsConfigurationPage($this);
$this->page->setProperties(array(
'name' => $this->vmName,
'linked-host_services' => $this->host . ' - ' . $this->hostService
'linked-host_services' => $this->host . ' - ' . $this->hostService,
'known_metrics' => $this->functionRPN,
));
$this->page->setProperties(array('function' => $this->functionRPN));
$this->page->save();
Expand Down
4 changes: 0 additions & 4 deletions lang/es_ES.UTF-8/LC_MESSAGES/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -9079,10 +9079,6 @@ msgstr "Compruebe si el servicio está parado"
msgid "Preexec definition"
msgstr "Definiendo el comando PREEXEC"

#: centreon-web/www/include/configuration/configObject/traps/formTraps.php:360
msgid "The same OID element already exists"
msgstr "El mismo OID ya existe."

#: centreon-web/www/include/configuration/configObject/traps/formTraps.php:368
msgid "Advanced matching rules"
msgstr "Reglas de correspondencia avanzadas"
Expand Down
Loading

0 comments on commit 4de8b7d

Please sign in to comment.