diff --git a/CHANGELOG.md b/CHANGELOG.md
index 145cf5a3a4..8ec1b0b225 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -11,6 +11,7 @@ All notable changes to the Wazuh app project will be documented in this file.
- Redesign the SCA table from agent's dashboard [#4512](https://github.com/wazuh/wazuh-kibana-app/pull/4512)
- Enhanced the plugin setting description displayed in the UI and the configuration file. [#4501](https://github.com/wazuh/wazuh-kibana-app/pull/4501)
- Added validation to the plugin settings in the form of `Settings/Configuration` and the endpoint to update the plugin configuration [#4503](https://github.com/wazuh/wazuh-kibana-app/pull/4503)
+- Added new plugin settings to customize the header and footer on the PDF reports [#4505](https://github.com/wazuh/wazuh-kibana-app/pull/4505)
### Changed
diff --git a/common/constants.ts b/common/constants.ts
index ce420326b9..dec85a3c86 100644
--- a/common/constants.ts
+++ b/common/constants.ts
@@ -358,6 +358,11 @@ export enum SettingCategory {
CUSTOMIZATION,
};
+type TPluginSettingOptionsTextArea = {
+ rowsSize?: number
+ maxLength?: number
+};
+
type TPluginSettingOptionsSelect = {
select: { text: string, value: any }[]
};
@@ -442,7 +447,13 @@ export type TPluginSetting = {
// Modify the setting requires restarting the plugin platform to take effect.
requiresRestartingPluginPlatform?: boolean
// Define options related to the `type`.
- options?: TPluginSettingOptionsNumber | TPluginSettingOptionsEditor | TPluginSettingOptionsFile | TPluginSettingOptionsSelect | TPluginSettingOptionsSwitch
+ options?:
+ TPluginSettingOptionsEditor |
+ TPluginSettingOptionsFile |
+ TPluginSettingOptionsNumber |
+ TPluginSettingOptionsSelect |
+ TPluginSettingOptionsSwitch |
+ TPluginSettingOptionsTextArea
// Transform the input value. The result is saved in the form global state of Settings/Configuration
uiFormTransformChangedInputValue?: (value: any) => any
// Transform the configuration value or default as initial value for the input in Settings/Configuration
@@ -545,7 +556,6 @@ export const PLUGIN_SETTINGS: { [key: string]: TPluginSetting } = {
validateBackend: function(schema){
return schema.boolean();
},
-
},
"checks.fields": {
title: "Known fields",
@@ -1072,6 +1082,46 @@ export const PLUGIN_SETTINGS: { [key: string]: TPluginSetting } = {
)(value)
},
},
+ "customization.reports.footer": {
+ title: "Reports footer",
+ description: "Set the footer of the reports.",
+ category: SettingCategory.CUSTOMIZATION,
+ type: EpluginSettingType.textarea,
+ defaultValue: "",
+ defaultValueIfNotSet: REPORTS_PAGE_FOOTER_TEXT,
+ isConfigurableFromFile: true,
+ isConfigurableFromUI: true,
+ options: { rowsSize: 2, maxLength: 30 },
+ validate: function (value) {
+ return SettingsValidator.multipleLinesString({
+ max: this.options.rowsSize,
+ maxLength: this.options.maxLength
+ })(value)
+ },
+ validateBackend: function (schema) {
+ return schema.string({ validate: this.validate.bind(this) });
+ },
+ },
+ "customization.reports.header": {
+ title: "Reports header",
+ description: "Set the header of the reports.",
+ category: SettingCategory.CUSTOMIZATION,
+ type: EpluginSettingType.textarea,
+ defaultValue: "",
+ defaultValueIfNotSet: REPORTS_PAGE_HEADER_TEXT,
+ isConfigurableFromFile: true,
+ isConfigurableFromUI: true,
+ options: { rowsSize: 3, maxLength: 20 },
+ validate: function (value) {
+ return SettingsValidator.multipleLinesString({
+ max: this.options.rowsSize,
+ maxLength: this.options?.maxLength
+ })(value)
+ },
+ validateBackend: function(schema){
+ return schema.string({validate: this.validate?.bind(this)});
+ },
+ },
"disabled_roles": {
title: "Disable roles",
description: "Disabled the plugin visibility for users with the roles.",
@@ -1785,7 +1835,6 @@ export const PLUGIN_SETTINGS: { [key: string]: TPluginSetting } = {
export type TPluginSettingKey = keyof typeof PLUGIN_SETTINGS;
-
export enum HTTP_STATUS_CODES {
CONTINUE = 100,
SWITCHING_PROTOCOLS = 101,
diff --git a/common/plugin-settings.test.ts b/common/plugin-settings.test.ts
index d67e514eab..d68f6dc4d2 100644
--- a/common/plugin-settings.test.ts
+++ b/common/plugin-settings.test.ts
@@ -2,235 +2,245 @@ import { PLUGIN_SETTINGS } from "./constants";
describe('[settings] Input validation', () => {
it.each`
- setting | value | expectedValidation
- ${'alerts.sample.prefix'} | ${'test'} | ${undefined}
- ${'alerts.sample.prefix'} | ${''} | ${"Value can not be empty."}
- ${'alerts.sample.prefix'} | ${'test space'} | ${"No whitespaces allowed."}
- ${'alerts.sample.prefix'} | ${'-test'} | ${"It can't start with: -, _, +, .."}
- ${'alerts.sample.prefix'} | ${'_test'} | ${"It can't start with: -, _, +, .."}
- ${'alerts.sample.prefix'} | ${'+test'} | ${"It can't start with: -, _, +, .."}
- ${'alerts.sample.prefix'} | ${'.test'} | ${"It can't start with: -, _, +, .."}
- ${'alerts.sample.prefix'} | ${'test\\'} | ${"It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
- ${'alerts.sample.prefix'} | ${'test/'} | ${"It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
- ${'alerts.sample.prefix'} | ${'test?'} | ${"It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
- ${'alerts.sample.prefix'} | ${'test"'} | ${"It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
- ${'alerts.sample.prefix'} | ${'test<'} | ${"It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
- ${'alerts.sample.prefix'} | ${'test>'} | ${"It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
- ${'alerts.sample.prefix'} | ${'test|'} | ${"It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
- ${'alerts.sample.prefix'} | ${'test,'} | ${"It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
- ${'alerts.sample.prefix'} | ${'test#'} | ${"It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
- ${'alerts.sample.prefix'} | ${'test*'} | ${"It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
- ${'checks.api'} | ${true} | ${undefined}
- ${'checks.api'} | ${0} | ${'It should be a boolean. Allowed values: true or false.'}
- ${'checks.fields'} | ${true} | ${undefined}
- ${'checks.fields'} | ${0} | ${'It should be a boolean. Allowed values: true or false.'}
- ${'checks.maxBuckets'} | ${true} | ${undefined}
- ${'checks.maxBuckets'} | ${0} | ${'It should be a boolean. Allowed values: true or false.'}
- ${'checks.pattern'} | ${true} | ${undefined}
- ${'checks.pattern'} | ${0} | ${'It should be a boolean. Allowed values: true or false.'}
- ${'checks.setup'} | ${true} | ${undefined}
- ${'checks.setup'} | ${0} | ${'It should be a boolean. Allowed values: true or false.'}
- ${'checks.template'} | ${true} | ${undefined}
- ${'checks.template'} | ${0} | ${'It should be a boolean. Allowed values: true or false.'}
- ${'checks.timeFilter'} | ${true} | ${undefined}
- ${'checks.timeFilter'} | ${0} | ${'It should be a boolean. Allowed values: true or false.'}
- ${'cron.prefix'} | ${'test'} | ${undefined}
- ${'cron.prefix'} | ${'test space'} | ${"No whitespaces allowed."}
- ${'cron.prefix'} | ${''} | ${"Value can not be empty."}
- ${'cron.prefix'} | ${'-test'} | ${"It can't start with: -, _, +, .."}
- ${'cron.prefix'} | ${'_test'} | ${"It can't start with: -, _, +, .."}
- ${'cron.prefix'} | ${'+test'} | ${"It can't start with: -, _, +, .."}
- ${'cron.prefix'} | ${'.test'} | ${"It can't start with: -, _, +, .."}
- ${'cron.prefix'} | ${'test\\'} | ${"It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
- ${'cron.prefix'} | ${'test/'} | ${"It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
- ${'cron.prefix'} | ${'test?'} | ${"It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
- ${'cron.prefix'} | ${'test"'} | ${"It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
- ${'cron.prefix'} | ${'test<'} | ${"It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
- ${'cron.prefix'} | ${'test>'} | ${"It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
- ${'cron.prefix'} | ${'test|'} | ${"It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
- ${'cron.prefix'} | ${'test,'} | ${"It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
- ${'cron.prefix'} | ${'test#'} | ${"It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
- ${'cron.prefix'} | ${'test*'} | ${"It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
- ${'cron.statistics.apis'} | ${['test']} | ${undefined}
- ${'cron.statistics.apis'} | ${['test ']} | ${"No whitespaces allowed."}
- ${'cron.statistics.apis'} | ${['']} | ${"Value can not be empty."}
- ${'cron.statistics.apis'} | ${['test', 4]} | ${"Value is not a string."}
- ${'cron.statistics.apis'} | ${'test space'} | ${"Value is not a valid list."}
- ${'cron.statistics.apis'} | ${true} | ${"Value is not a valid list."}
- ${'cron.statistics.index.creation'} | ${'h'} | ${undefined}
- ${'cron.statistics.index.creation'} | ${'d'} | ${undefined}
- ${'cron.statistics.index.creation'} | ${'w'} | ${undefined}
- ${'cron.statistics.index.creation'} | ${'m'} | ${undefined}
- ${'cron.statistics.index.creation'} | ${'test'} | ${"Invalid value. Allowed values: h, d, w, m."}
- ${'cron.statistics.index.name'} | ${'test'} | ${undefined}
- ${'cron.statistics.index.name'} | ${''} | ${"Value can not be empty."}
- ${'cron.statistics.index.name'} | ${'test space'} | ${"No whitespaces allowed."}
- ${'cron.statistics.index.name'} | ${'-test'} | ${"It can't start with: -, _, +, .."}
- ${'cron.statistics.index.name'} | ${'_test'} | ${"It can't start with: -, _, +, .."}
- ${'cron.statistics.index.name'} | ${'+test'} | ${"It can't start with: -, _, +, .."}
- ${'cron.statistics.index.name'} | ${'.test'} | ${"It can't start with: -, _, +, .."}
- ${'cron.statistics.index.name'} | ${'test\\'} | ${"It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
- ${'cron.statistics.index.name'} | ${'test/'} | ${"It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
- ${'cron.statistics.index.name'} | ${'test?'} | ${"It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
- ${'cron.statistics.index.name'} | ${'test"'} | ${"It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
- ${'cron.statistics.index.name'} | ${'test<'} | ${"It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
- ${'cron.statistics.index.name'} | ${'test>'} | ${"It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
- ${'cron.statistics.index.name'} | ${'test|'} | ${"It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
- ${'cron.statistics.index.name'} | ${'test,'} | ${"It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
- ${'cron.statistics.index.name'} | ${'test#'} | ${"It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
- ${'cron.statistics.index.name'} | ${'test*'} | ${"It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
- ${'cron.statistics.index.replicas'} | ${0} | ${undefined}
- ${'cron.statistics.index.replicas'} | ${-1} | ${"Value should be greater or equal than 0."}
- ${'cron.statistics.index.replicas'} | ${'1.2'} | ${'Number should be an integer.'}
- ${'cron.statistics.index.replicas'} | ${1.2} | ${'Number should be an integer.'}
- ${'cron.statistics.index.shards'} | ${1} | ${undefined}
- ${'cron.statistics.index.shards'} | ${-1} | ${"Value should be greater or equal than 1."}
- ${'cron.statistics.index.shards'} | ${'1.2'} | ${'Number should be an integer.'}
- ${'cron.statistics.index.shards'} | ${1.2} | ${'Number should be an integer.'}
- ${'cron.statistics.interval'} | ${'0 */5 * * * *'} | ${undefined}
- ${'cron.statistics.interval'} | ${'0 */5 * * *'} | ${undefined}
- ${'cron.statistics.interval'} | ${'custom'} | ${"Interval is not valid."}
- ${'cron.statistics.interval'} | ${true} | ${"Interval is not valid."}
- ${'cron.statistics.status'} | ${true} | ${undefined}
- ${'cron.statistics.status'} | ${0} | ${'It should be a boolean. Allowed values: true or false.'}
- ${'customization.logo.app'} | ${{size: 124000, name: 'image.jpg'}} | ${undefined}
- ${'customization.logo.app'} | ${{size: 124000, name: 'image.jpeg'}} | ${undefined}
- ${'customization.logo.app'} | ${{size: 124000, name: 'image.png'}} | ${undefined}
- ${'customization.logo.app'} | ${{size: 124000, name: 'image.svg'}} | ${undefined}
- ${'customization.logo.app'} | ${{size: 124000, name: 'image.txt'}} | ${'File extension is invalid. Allowed file extensions: .jpeg, .jpg, .png, .svg.'}
- ${'customization.logo.app'} | ${{size: 1240000, name: 'image.txt'}} | ${'File size should be lower or equal than 1 MB.'}
- ${'customization.logo.healthcheck'} | ${{size: 124000, name: 'image.jpg'}} | ${undefined}
- ${'customization.logo.healthcheck'} | ${{size: 124000, name: 'image.jpeg'}} | ${undefined}
- ${'customization.logo.healthcheck'} | ${{size: 124000, name: 'image.png'}} | ${undefined}
- ${'customization.logo.healthcheck'} | ${{size: 124000, name: 'image.svg'}} | ${undefined}
- ${'customization.logo.healthcheck'} | ${{size: 124000, name: 'image.txt'}} | ${'File extension is invalid. Allowed file extensions: .jpeg, .jpg, .png, .svg.'}
- ${'customization.logo.healthcheck'} | ${{size: 1240000, name: 'image.txt'}} | ${'File size should be lower or equal than 1 MB.'}
- ${'customization.logo.reports'} | ${{size: 124000, name: 'image.jpg'}} | ${undefined}
- ${'customization.logo.reports'} | ${{size: 124000, name: 'image.jpeg'}} | ${undefined}
- ${'customization.logo.reports'} | ${{size: 124000, name: 'image.png'}} | ${undefined}
- ${'customization.logo.reports'} | ${{size: 124000, name: 'image.svg'}} | ${'File extension is invalid. Allowed file extensions: .jpeg, .jpg, .png.'}
- ${'customization.logo.reports'} | ${{size: 124000, name: 'image.txt'}} | ${'File extension is invalid. Allowed file extensions: .jpeg, .jpg, .png.'}
- ${'customization.logo.reports'} | ${{size: 1240000, name: 'image.txt'}} | ${'File size should be lower or equal than 1 MB.'}
- ${'customization.logo.sidebar'} | ${{size: 124000, name: 'image.jpg'}} | ${undefined}
- ${'customization.logo.sidebar'} | ${{size: 124000, name: 'image.jpeg'}} | ${undefined}
- ${'customization.logo.sidebar'} | ${{size: 124000, name: 'image.png'}} | ${undefined}
- ${'customization.logo.sidebar'} | ${{size: 124000, name: 'image.svg'}} | ${undefined}
- ${'customization.logo.sidebar'} | ${{size: 124000, name: 'image.txt'}} | ${'File extension is invalid. Allowed file extensions: .jpeg, .jpg, .png, .svg.'}
- ${'customization.logo.sidebar'} | ${{size: 1240000, name: 'image.txt'}} | ${'File size should be lower or equal than 1 MB.'}
- ${'disabled_roles'} | ${['test']} | ${undefined}
- ${'disabled_roles'} | ${['']} | ${'Value can not be empty.'}
- ${'disabled_roles'} | ${['test space']} | ${"No whitespaces allowed."}
- ${'disabled_roles'} | ${['test', 4]} | ${"Value is not a string."}
- ${'enrollment.dns'} | ${'test'} | ${undefined}
- ${'enrollment.dns'} | ${''} | ${undefined}
- ${'enrollment.dns'} | ${'test space'} | ${"No whitespaces allowed."}
- ${'enrollment.password'} | ${'test'} | ${undefined}
- ${'enrollment.password'} | ${''} | ${"Value can not be empty."}
- ${'enrollment.password'} | ${'test space'} | ${undefined}
- ${'extensions.audit'} | ${true} | ${undefined}
- ${'extensions.audit'} | ${0} | ${'It should be a boolean. Allowed values: true or false.'}
- ${'extensions.aws'} | ${true} | ${undefined}
- ${'extensions.aws'} | ${0} | ${'It should be a boolean. Allowed values: true or false.'}
- ${'extensions.ciscat'} | ${true} | ${undefined}
- ${'extensions.ciscat'} | ${0} | ${'It should be a boolean. Allowed values: true or false.'}
- ${'extensions.gcp'} | ${true} | ${undefined}
- ${'extensions.gcp'} | ${0} | ${'It should be a boolean. Allowed values: true or false.'}
- ${'extensions.gdpr'} | ${true} | ${undefined}
- ${'extensions.gdpr'} | ${0} | ${'It should be a boolean. Allowed values: true or false.'}
- ${'extensions.hipaa'} | ${true} | ${undefined}
- ${'extensions.hipaa'} | ${0} | ${'It should be a boolean. Allowed values: true or false.'}
- ${'extensions.nist'} | ${true} | ${undefined}
- ${'extensions.nist'} | ${0} | ${'It should be a boolean. Allowed values: true or false.'}
- ${'extensions.oscap'} | ${true} | ${undefined}
- ${'extensions.oscap'} | ${0} | ${'It should be a boolean. Allowed values: true or false.'}
- ${'extensions.osquery'} | ${true} | ${undefined}
- ${'extensions.osquery'} | ${0} | ${'It should be a boolean. Allowed values: true or false.'}
- ${'extensions.pci'} | ${true} | ${undefined}
- ${'extensions.pci'} | ${0} | ${'It should be a boolean. Allowed values: true or false.'}
- ${'extensions.tsc'} | ${true} | ${undefined}
- ${'extensions.tsc'} | ${0} | ${'It should be a boolean. Allowed values: true or false.'}
- ${'extensions.virustotal'} | ${true} | ${undefined}
- ${'extensions.virustotal'} | ${0} | ${'It should be a boolean. Allowed values: true or false.'}
- ${'ip.ignore'} | ${['test']} | ${undefined}
- ${'ip.ignore'} | ${['test*']} | ${undefined}
- ${'ip.ignore'} | ${['']} | ${'Value can not be empty.'}
- ${'ip.ignore'} | ${['test space']} | ${"No whitespaces allowed."}
- ${'ip.ignore'} | ${true} | ${"Value is not a valid list."}
- ${'ip.ignore'} | ${['-test']} | ${"It can't start with: -, _, +, .."}
- ${'ip.ignore'} | ${['_test']} | ${"It can't start with: -, _, +, .."}
- ${'ip.ignore'} | ${['+test']} | ${"It can't start with: -, _, +, .."}
- ${'ip.ignore'} | ${['.test']} | ${"It can't start with: -, _, +, .."}
- ${'ip.ignore'} | ${['test\\']} | ${"It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #."}
- ${'ip.ignore'} | ${['test/']} | ${"It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #."}
- ${'ip.ignore'} | ${['test?']} | ${"It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #."}
- ${'ip.ignore'} | ${['test"']} | ${"It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #."}
- ${'ip.ignore'} | ${['test<']} | ${"It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #."}
- ${'ip.ignore'} | ${['test>']} | ${"It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #."}
- ${'ip.ignore'} | ${['test|']} | ${"It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #."}
- ${'ip.ignore'} | ${['test,']} | ${"It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #."}
- ${'ip.ignore'} | ${['test#']} | ${"It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #."}
- ${'ip.ignore'} | ${['test', 'test#']} | ${"It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #."}
- ${'ip.selector'} | ${true} | ${undefined}
- ${'ip.selector'} | ${''} | ${'It should be a boolean. Allowed values: true or false.'}
- ${'logs.level'} | ${'info'} | ${undefined}
- ${'logs.level'} | ${'debug'} | ${undefined}
- ${'logs.level'} | ${''} | ${'Invalid value. Allowed values: info, debug.'}
- ${'pattern'} | ${'test'} | ${undefined}
- ${'pattern'} | ${'test*'} | ${undefined}
- ${'pattern'} | ${''} | ${'Value can not be empty.'}
- ${'pattern'} | ${'test space'} | ${"No whitespaces allowed."}
- ${'pattern'} | ${'-test'} | ${"It can't start with: -, _, +, .."}
- ${'pattern'} | ${'_test'} | ${"It can't start with: -, _, +, .."}
- ${'pattern'} | ${'+test'} | ${"It can't start with: -, _, +, .."}
- ${'pattern'} | ${'.test'} | ${"It can't start with: -, _, +, .."}
- ${'pattern'} | ${'test\\'} | ${"It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #."}
- ${'pattern'} | ${'test/'} | ${"It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #."}
- ${'pattern'} | ${'test?'} | ${"It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #."}
- ${'pattern'} | ${'test"'} | ${"It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #."}
- ${'pattern'} | ${'test<'} | ${"It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #."}
- ${'pattern'} | ${'test>'} | ${"It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #."}
- ${'pattern'} | ${'test|'} | ${"It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #."}
- ${'pattern'} | ${'test,'} | ${"It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #."}
- ${'pattern'} | ${'test#'} | ${"It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #."}
- ${'timeout'} | ${15000} | ${undefined}
- ${'timeout'} | ${1000} | ${'Value should be greater or equal than 1500.'}
- ${'timeout'} | ${''} | ${'Value should be greater or equal than 1500.'}
- ${'timeout'} | ${'1.2'} | ${'Number should be an integer.'}
- ${'timeout'} | ${1.2} | ${'Number should be an integer.'}
- ${'wazuh.monitoring.creation'} | ${'h'} | ${undefined}
- ${'wazuh.monitoring.creation'} | ${'d'} | ${undefined}
- ${'wazuh.monitoring.creation'} | ${'w'} | ${undefined}
- ${'wazuh.monitoring.creation'} | ${'m'} | ${undefined}
- ${'wazuh.monitoring.creation'} | ${'test'} | ${"Invalid value. Allowed values: h, d, w, m."}
- ${'wazuh.monitoring.enabled'} | ${true} | ${undefined}
- ${'wazuh.monitoring.frequency'} | ${100} | ${undefined}
- ${'wazuh.monitoring.frequency'} | ${40} | ${"Value should be greater or equal than 60."}
- ${'wazuh.monitoring.frequency'} | ${'1.2'} | ${'Number should be an integer.'}
- ${'wazuh.monitoring.frequency'} | ${1.2} | ${'Number should be an integer.'}
- ${'wazuh.monitoring.pattern'} | ${'test'} | ${undefined}
- ${'wazuh.monitoring.pattern'} | ${'test*'} | ${undefined}
- ${'wazuh.monitoring.pattern'} | ${''} | ${'Value can not be empty.'}
- ${'wazuh.monitoring.pattern'} | ${'-test'} | ${"It can't start with: -, _, +, .."}
- ${'wazuh.monitoring.pattern'} | ${'_test'} | ${"It can't start with: -, _, +, .."}
- ${'wazuh.monitoring.pattern'} | ${'+test'} | ${"It can't start with: -, _, +, .."}
- ${'wazuh.monitoring.pattern'} | ${'.test'} | ${"It can't start with: -, _, +, .."}
- ${'wazuh.monitoring.pattern'} | ${'test\\'} | ${"It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #."}
- ${'wazuh.monitoring.pattern'} | ${'test/'} | ${"It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #."}
- ${'wazuh.monitoring.pattern'} | ${'test?'} | ${"It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #."}
- ${'wazuh.monitoring.pattern'} | ${'test"'} | ${"It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #."}
- ${'wazuh.monitoring.pattern'} | ${'test<'} | ${"It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #."}
- ${'wazuh.monitoring.pattern'} | ${'test>'} | ${"It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #."}
- ${'wazuh.monitoring.pattern'} | ${'test|'} | ${"It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #."}
- ${'wazuh.monitoring.pattern'} | ${'test,'} | ${"It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #."}
- ${'wazuh.monitoring.pattern'} | ${'test#'} | ${"It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #."}
- ${'wazuh.monitoring.replicas'} | ${0} | ${undefined}
- ${'wazuh.monitoring.replicas'} | ${-1} | ${"Value should be greater or equal than 0."}
- ${'wazuh.monitoring.replicas'} | ${'1.2'} | ${'Number should be an integer.'}
- ${'wazuh.monitoring.replicas'} | ${1.2} | ${'Number should be an integer.'}
- ${'wazuh.monitoring.shards'} | ${1} | ${undefined}
- ${'wazuh.monitoring.shards'} | ${-1} | ${"Value should be greater or equal than 1."}
- ${'wazuh.monitoring.shards'} | ${'1.2'} | ${'Number should be an integer.'}
- ${'wazuh.monitoring.shards'} | ${1.2} | ${'Number should be an integer.'}
+ setting | value | expectedValidation
+ ${'alerts.sample.prefix'} | ${'test'} | ${undefined}
+ ${'alerts.sample.prefix'} | ${''} | ${"Value can not be empty."}
+ ${'alerts.sample.prefix'} | ${'test space'} | ${"No whitespaces allowed."}
+ ${'alerts.sample.prefix'} | ${'-test'} | ${"It can't start with: -, _, +, .."}
+ ${'alerts.sample.prefix'} | ${'_test'} | ${"It can't start with: -, _, +, .."}
+ ${'alerts.sample.prefix'} | ${'+test'} | ${"It can't start with: -, _, +, .."}
+ ${'alerts.sample.prefix'} | ${'.test'} | ${"It can't start with: -, _, +, .."}
+ ${'alerts.sample.prefix'} | ${'test\\'} | ${"It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
+ ${'alerts.sample.prefix'} | ${'test/'} | ${"It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
+ ${'alerts.sample.prefix'} | ${'test?'} | ${"It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
+ ${'alerts.sample.prefix'} | ${'test"'} | ${"It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
+ ${'alerts.sample.prefix'} | ${'test<'} | ${"It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
+ ${'alerts.sample.prefix'} | ${'test>'} | ${"It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
+ ${'alerts.sample.prefix'} | ${'test|'} | ${"It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
+ ${'alerts.sample.prefix'} | ${'test,'} | ${"It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
+ ${'alerts.sample.prefix'} | ${'test#'} | ${"It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
+ ${'alerts.sample.prefix'} | ${'test*'} | ${"It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
+ ${'checks.api'} | ${true} | ${undefined}
+ ${'checks.api'} | ${0} | ${'It should be a boolean. Allowed values: true or false.'}
+ ${'checks.fields'} | ${true} | ${undefined}
+ ${'checks.fields'} | ${0} | ${'It should be a boolean. Allowed values: true or false.'}
+ ${'checks.maxBuckets'} | ${true} | ${undefined}
+ ${'checks.maxBuckets'} | ${0} | ${'It should be a boolean. Allowed values: true or false.'}
+ ${'checks.pattern'} | ${true} | ${undefined}
+ ${'checks.pattern'} | ${0} | ${'It should be a boolean. Allowed values: true or false.'}
+ ${'checks.setup'} | ${true} | ${undefined}
+ ${'checks.setup'} | ${0} | ${'It should be a boolean. Allowed values: true or false.'}
+ ${'checks.template'} | ${true} | ${undefined}
+ ${'checks.template'} | ${0} | ${'It should be a boolean. Allowed values: true or false.'}
+ ${'checks.timeFilter'} | ${true} | ${undefined}
+ ${'checks.timeFilter'} | ${0} | ${'It should be a boolean. Allowed values: true or false.'}
+ ${'cron.prefix'} | ${'test'} | ${undefined}
+ ${'cron.prefix'} | ${'test space'} | ${"No whitespaces allowed."}
+ ${'cron.prefix'} | ${''} | ${"Value can not be empty."}
+ ${'cron.prefix'} | ${'-test'} | ${"It can't start with: -, _, +, .."}
+ ${'cron.prefix'} | ${'_test'} | ${"It can't start with: -, _, +, .."}
+ ${'cron.prefix'} | ${'+test'} | ${"It can't start with: -, _, +, .."}
+ ${'cron.prefix'} | ${'.test'} | ${"It can't start with: -, _, +, .."}
+ ${'cron.prefix'} | ${'test\\'} | ${"It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
+ ${'cron.prefix'} | ${'test/'} | ${"It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
+ ${'cron.prefix'} | ${'test?'} | ${"It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
+ ${'cron.prefix'} | ${'test"'} | ${"It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
+ ${'cron.prefix'} | ${'test<'} | ${"It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
+ ${'cron.prefix'} | ${'test>'} | ${"It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
+ ${'cron.prefix'} | ${'test|'} | ${"It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
+ ${'cron.prefix'} | ${'test,'} | ${"It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
+ ${'cron.prefix'} | ${'test#'} | ${"It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
+ ${'cron.prefix'} | ${'test*'} | ${"It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
+ ${'cron.statistics.apis'} | ${['test']} | ${undefined}
+ ${'cron.statistics.apis'} | ${['test ']} | ${"No whitespaces allowed."}
+ ${'cron.statistics.apis'} | ${['']} | ${"Value can not be empty."}
+ ${'cron.statistics.apis'} | ${['test', 4]} | ${"Value is not a string."}
+ ${'cron.statistics.apis'} | ${'test space'} | ${"Value is not a valid list."}
+ ${'cron.statistics.apis'} | ${true} | ${"Value is not a valid list."}
+ ${'cron.statistics.index.creation'} | ${'h'} | ${undefined}
+ ${'cron.statistics.index.creation'} | ${'d'} | ${undefined}
+ ${'cron.statistics.index.creation'} | ${'w'} | ${undefined}
+ ${'cron.statistics.index.creation'} | ${'m'} | ${undefined}
+ ${'cron.statistics.index.creation'} | ${'test'} | ${"Invalid value. Allowed values: h, d, w, m."}
+ ${'cron.statistics.index.name'} | ${'test'} | ${undefined}
+ ${'cron.statistics.index.name'} | ${''} | ${"Value can not be empty."}
+ ${'cron.statistics.index.name'} | ${'test space'} | ${"No whitespaces allowed."}
+ ${'cron.statistics.index.name'} | ${'-test'} | ${"It can't start with: -, _, +, .."}
+ ${'cron.statistics.index.name'} | ${'_test'} | ${"It can't start with: -, _, +, .."}
+ ${'cron.statistics.index.name'} | ${'+test'} | ${"It can't start with: -, _, +, .."}
+ ${'cron.statistics.index.name'} | ${'.test'} | ${"It can't start with: -, _, +, .."}
+ ${'cron.statistics.index.name'} | ${'test\\'} | ${"It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
+ ${'cron.statistics.index.name'} | ${'test/'} | ${"It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
+ ${'cron.statistics.index.name'} | ${'test?'} | ${"It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
+ ${'cron.statistics.index.name'} | ${'test"'} | ${"It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
+ ${'cron.statistics.index.name'} | ${'test<'} | ${"It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
+ ${'cron.statistics.index.name'} | ${'test>'} | ${"It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
+ ${'cron.statistics.index.name'} | ${'test|'} | ${"It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
+ ${'cron.statistics.index.name'} | ${'test,'} | ${"It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
+ ${'cron.statistics.index.name'} | ${'test#'} | ${"It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
+ ${'cron.statistics.index.name'} | ${'test*'} | ${"It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
+ ${'cron.statistics.index.replicas'} | ${0} | ${undefined}
+ ${'cron.statistics.index.replicas'} | ${-1} | ${"Value should be greater or equal than 0."}
+ ${'cron.statistics.index.replicas'} | ${'1.2'} | ${'Number should be an integer.'}
+ ${'cron.statistics.index.replicas'} | ${1.2} | ${'Number should be an integer.'}
+ ${'cron.statistics.index.shards'} | ${1} | ${undefined}
+ ${'cron.statistics.index.shards'} | ${-1} | ${"Value should be greater or equal than 1."}
+ ${'cron.statistics.index.shards'} | ${'1.2'} | ${'Number should be an integer.'}
+ ${'cron.statistics.index.shards'} | ${1.2} | ${'Number should be an integer.'}
+ ${'cron.statistics.interval'} | ${'0 */5 * * * *'} | ${undefined}
+ ${'cron.statistics.interval'} | ${'0 */5 * * *'} | ${undefined}
+ ${'cron.statistics.interval'} | ${'custom'} | ${"Interval is not valid."}
+ ${'cron.statistics.interval'} | ${true} | ${"Interval is not valid."}
+ ${'cron.statistics.status'} | ${true} | ${undefined}
+ ${'cron.statistics.status'} | ${0} | ${'It should be a boolean. Allowed values: true or false.'}
+ ${'customization.logo.app'} | ${{size: 124000, name: 'image.jpg'}} | ${undefined}
+ ${'customization.logo.app'} | ${{size: 124000, name: 'image.jpeg'}} | ${undefined}
+ ${'customization.logo.app'} | ${{size: 124000, name: 'image.png'}} | ${undefined}
+ ${'customization.logo.app'} | ${{size: 124000, name: 'image.svg'}} | ${undefined}
+ ${'customization.logo.app'} | ${{size: 124000, name: 'image.txt'}} | ${'File extension is invalid. Allowed file extensions: .jpeg, .jpg, .png, .svg.'}
+ ${'customization.logo.app'} | ${{size: 1240000, name: 'image.txt'}} | ${'File size should be lower or equal than 1 MB.'}
+ ${'customization.logo.healthcheck'} | ${{size: 124000, name: 'image.jpg'}} | ${undefined}
+ ${'customization.logo.healthcheck'} | ${{size: 124000, name: 'image.jpeg'}} | ${undefined}
+ ${'customization.logo.healthcheck'} | ${{size: 124000, name: 'image.png'}} | ${undefined}
+ ${'customization.logo.healthcheck'} | ${{size: 124000, name: 'image.svg'}} | ${undefined}
+ ${'customization.logo.healthcheck'} | ${{size: 124000, name: 'image.txt'}} | ${'File extension is invalid. Allowed file extensions: .jpeg, .jpg, .png, .svg.'}
+ ${'customization.logo.healthcheck'} | ${{size: 1240000, name: 'image.txt'}} | ${'File size should be lower or equal than 1 MB.'}
+ ${'customization.logo.reports'} | ${{size: 124000, name: 'image.jpg'}} | ${undefined}
+ ${'customization.logo.reports'} | ${{size: 124000, name: 'image.jpeg'}} | ${undefined}
+ ${'customization.logo.reports'} | ${{size: 124000, name: 'image.png'}} | ${undefined}
+ ${'customization.logo.reports'} | ${{size: 124000, name: 'image.svg'}} | ${'File extension is invalid. Allowed file extensions: .jpeg, .jpg, .png.'}
+ ${'customization.logo.reports'} | ${{size: 124000, name: 'image.txt'}} | ${'File extension is invalid. Allowed file extensions: .jpeg, .jpg, .png.'}
+ ${'customization.logo.reports'} | ${{size: 1240000, name: 'image.txt'}} | ${'File size should be lower or equal than 1 MB.'}
+ ${'customization.logo.sidebar'} | ${{size: 124000, name: 'image.jpg'}} | ${undefined}
+ ${'customization.logo.sidebar'} | ${{size: 124000, name: 'image.jpeg'}} | ${undefined}
+ ${'customization.logo.sidebar'} | ${{size: 124000, name: 'image.png'}} | ${undefined}
+ ${'customization.logo.sidebar'} | ${{size: 124000, name: 'image.svg'}} | ${undefined}
+ ${'customization.logo.sidebar'} | ${{size: 124000, name: 'image.txt'}} | ${'File extension is invalid. Allowed file extensions: .jpeg, .jpg, .png, .svg.'}
+ ${'customization.logo.sidebar'} | ${{size: 1240000, name: 'image.txt'}} | ${'File size should be lower or equal than 1 MB.'}
+ ${'customization.reports.footer'} | ${'Test'} | ${undefined}
+ ${'customization.reports.footer'} | ${'Test\nTest'} | ${undefined}
+ ${'customization.reports.footer'} | ${'Test\nTest\nTest\nTest\nTest'} | ${'The string should have less or equal to 2 line/s.'}
+ ${'customization.reports.footer'} | ${'Line with 30 characters \nTest'} | ${undefined}
+ ${'customization.reports.footer'} | ${'Line with 31 characters \nTest'} | ${"The maximum length of a line is 30 characters."}
+ ${'customization.reports.header'} | ${'Test'} | ${undefined}
+ ${'customization.reports.header'} | ${'Test\nTest'} | ${undefined}
+ ${'customization.reports.header'} | ${'Test\nTest\nTest\nTest\nTest'} | ${'The string should have less or equal to 3 line/s.'}
+ ${'customization.reports.header'} | ${'Line with 20 charact\nTest'} | ${undefined}
+ ${'customization.reports.header'} | ${'Line with 23 characters\nTest'} | ${"The maximum length of a line is 20 characters."}
+ ${'disabled_roles'} | ${['test']} | ${undefined}
+ ${'disabled_roles'} | ${['']} | ${'Value can not be empty.'}
+ ${'disabled_roles'} | ${['test space']} | ${"No whitespaces allowed."}
+ ${'disabled_roles'} | ${['test', 4]} | ${"Value is not a string."}
+ ${'enrollment.dns'} | ${'test'} | ${undefined}
+ ${'enrollment.dns'} | ${''} | ${undefined}
+ ${'enrollment.dns'} | ${'test space'} | ${"No whitespaces allowed."}
+ ${'enrollment.password'} | ${'test'} | ${undefined}
+ ${'enrollment.password'} | ${''} | ${"Value can not be empty."}
+ ${'enrollment.password'} | ${'test space'} | ${undefined}
+ ${'extensions.audit'} | ${true} | ${undefined}
+ ${'extensions.audit'} | ${0} | ${'It should be a boolean. Allowed values: true or false.'}
+ ${'extensions.aws'} | ${true} | ${undefined}
+ ${'extensions.aws'} | ${0} | ${'It should be a boolean. Allowed values: true or false.'}
+ ${'extensions.ciscat'} | ${true} | ${undefined}
+ ${'extensions.ciscat'} | ${0} | ${'It should be a boolean. Allowed values: true or false.'}
+ ${'extensions.gcp'} | ${true} | ${undefined}
+ ${'extensions.gcp'} | ${0} | ${'It should be a boolean. Allowed values: true or false.'}
+ ${'extensions.gdpr'} | ${true} | ${undefined}
+ ${'extensions.gdpr'} | ${0} | ${'It should be a boolean. Allowed values: true or false.'}
+ ${'extensions.hipaa'} | ${true} | ${undefined}
+ ${'extensions.hipaa'} | ${0} | ${'It should be a boolean. Allowed values: true or false.'}
+ ${'extensions.nist'} | ${true} | ${undefined}
+ ${'extensions.nist'} | ${0} | ${'It should be a boolean. Allowed values: true or false.'}
+ ${'extensions.oscap'} | ${true} | ${undefined}
+ ${'extensions.oscap'} | ${0} | ${'It should be a boolean. Allowed values: true or false.'}
+ ${'extensions.osquery'} | ${true} | ${undefined}
+ ${'extensions.osquery'} | ${0} | ${'It should be a boolean. Allowed values: true or false.'}
+ ${'extensions.pci'} | ${true} | ${undefined}
+ ${'extensions.pci'} | ${0} | ${'It should be a boolean. Allowed values: true or false.'}
+ ${'extensions.tsc'} | ${true} | ${undefined}
+ ${'extensions.tsc'} | ${0} | ${'It should be a boolean. Allowed values: true or false.'}
+ ${'extensions.virustotal'} | ${true} | ${undefined}
+ ${'extensions.virustotal'} | ${0} | ${'It should be a boolean. Allowed values: true or false.'}
+ ${'ip.ignore'} | ${['test']} | ${undefined}
+ ${'ip.ignore'} | ${['test*']} | ${undefined}
+ ${'ip.ignore'} | ${['']} | ${'Value can not be empty.'}
+ ${'ip.ignore'} | ${['test space']} | ${"No whitespaces allowed."}
+ ${'ip.ignore'} | ${true} | ${"Value is not a valid list."}
+ ${'ip.ignore'} | ${['-test']} | ${"It can't start with: -, _, +, .."}
+ ${'ip.ignore'} | ${['_test']} | ${"It can't start with: -, _, +, .."}
+ ${'ip.ignore'} | ${['+test']} | ${"It can't start with: -, _, +, .."}
+ ${'ip.ignore'} | ${['.test']} | ${"It can't start with: -, _, +, .."}
+ ${'ip.ignore'} | ${['test\\']} | ${"It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #."}
+ ${'ip.ignore'} | ${['test/']} | ${"It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #."}
+ ${'ip.ignore'} | ${['test?']} | ${"It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #."}
+ ${'ip.ignore'} | ${['test"']} | ${"It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #."}
+ ${'ip.ignore'} | ${['test<']} | ${"It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #."}
+ ${'ip.ignore'} | ${['test>']} | ${"It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #."}
+ ${'ip.ignore'} | ${['test|']} | ${"It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #."}
+ ${'ip.ignore'} | ${['test,']} | ${"It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #."}
+ ${'ip.ignore'} | ${['test#']} | ${"It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #."}
+ ${'ip.ignore'} | ${['test', 'test#']} | ${"It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #."}
+ ${'ip.selector'} | ${true} | ${undefined}
+ ${'ip.selector'} | ${''} | ${'It should be a boolean. Allowed values: true or false.'}
+ ${'logs.level'} | ${'info'} | ${undefined}
+ ${'logs.level'} | ${'debug'} | ${undefined}
+ ${'logs.level'} | ${''} | ${'Invalid value. Allowed values: info, debug.'}
+ ${'pattern'} | ${'test'} | ${undefined}
+ ${'pattern'} | ${'test*'} | ${undefined}
+ ${'pattern'} | ${''} | ${'Value can not be empty.'}
+ ${'pattern'} | ${'test space'} | ${"No whitespaces allowed."}
+ ${'pattern'} | ${'-test'} | ${"It can't start with: -, _, +, .."}
+ ${'pattern'} | ${'_test'} | ${"It can't start with: -, _, +, .."}
+ ${'pattern'} | ${'+test'} | ${"It can't start with: -, _, +, .."}
+ ${'pattern'} | ${'.test'} | ${"It can't start with: -, _, +, .."}
+ ${'pattern'} | ${'test\\'} | ${"It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #."}
+ ${'pattern'} | ${'test/'} | ${"It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #."}
+ ${'pattern'} | ${'test?'} | ${"It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #."}
+ ${'pattern'} | ${'test"'} | ${"It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #."}
+ ${'pattern'} | ${'test<'} | ${"It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #."}
+ ${'pattern'} | ${'test>'} | ${"It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #."}
+ ${'pattern'} | ${'test|'} | ${"It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #."}
+ ${'pattern'} | ${'test,'} | ${"It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #."}
+ ${'pattern'} | ${'test#'} | ${"It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #."}
+ ${'timeout'} | ${15000} | ${undefined}
+ ${'timeout'} | ${1000} | ${'Value should be greater or equal than 1500.'}
+ ${'timeout'} | ${''} | ${'Value should be greater or equal than 1500.'}
+ ${'timeout'} | ${'1.2'} | ${'Number should be an integer.'}
+ ${'timeout'} | ${1.2} | ${'Number should be an integer.'}
+ ${'wazuh.monitoring.creation'} | ${'h'} | ${undefined}
+ ${'wazuh.monitoring.creation'} | ${'d'} | ${undefined}
+ ${'wazuh.monitoring.creation'} | ${'w'} | ${undefined}
+ ${'wazuh.monitoring.creation'} | ${'m'} | ${undefined}
+ ${'wazuh.monitoring.creation'} | ${'test'} | ${"Invalid value. Allowed values: h, d, w, m."}
+ ${'wazuh.monitoring.enabled'} | ${true} | ${undefined}
+ ${'wazuh.monitoring.frequency'} | ${100} | ${undefined}
+ ${'wazuh.monitoring.frequency'} | ${40} | ${"Value should be greater or equal than 60."}
+ ${'wazuh.monitoring.frequency'} | ${'1.2'} | ${'Number should be an integer.'}
+ ${'wazuh.monitoring.frequency'} | ${1.2} | ${'Number should be an integer.'}
+ ${'wazuh.monitoring.pattern'} | ${'test'} | ${undefined}
+ ${'wazuh.monitoring.pattern'} | ${'test*'} | ${undefined}
+ ${'wazuh.monitoring.pattern'} | ${''} | ${'Value can not be empty.'}
+ ${'wazuh.monitoring.pattern'} | ${'-test'} | ${"It can't start with: -, _, +, .."}
+ ${'wazuh.monitoring.pattern'} | ${'_test'} | ${"It can't start with: -, _, +, .."}
+ ${'wazuh.monitoring.pattern'} | ${'+test'} | ${"It can't start with: -, _, +, .."}
+ ${'wazuh.monitoring.pattern'} | ${'.test'} | ${"It can't start with: -, _, +, .."}
+ ${'wazuh.monitoring.pattern'} | ${'test\\'} | ${"It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #."}
+ ${'wazuh.monitoring.pattern'} | ${'test/'} | ${"It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #."}
+ ${'wazuh.monitoring.pattern'} | ${'test?'} | ${"It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #."}
+ ${'wazuh.monitoring.pattern'} | ${'test"'} | ${"It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #."}
+ ${'wazuh.monitoring.pattern'} | ${'test<'} | ${"It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #."}
+ ${'wazuh.monitoring.pattern'} | ${'test>'} | ${"It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #."}
+ ${'wazuh.monitoring.pattern'} | ${'test|'} | ${"It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #."}
+ ${'wazuh.monitoring.pattern'} | ${'test,'} | ${"It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #."}
+ ${'wazuh.monitoring.pattern'} | ${'test#'} | ${"It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #."}
+ ${'wazuh.monitoring.replicas'} | ${0} | ${undefined}
+ ${'wazuh.monitoring.replicas'} | ${-1} | ${"Value should be greater or equal than 0."}
+ ${'wazuh.monitoring.replicas'} | ${'1.2'} | ${'Number should be an integer.'}
+ ${'wazuh.monitoring.replicas'} | ${1.2} | ${'Number should be an integer.'}
+ ${'wazuh.monitoring.shards'} | ${1} | ${undefined}
+ ${'wazuh.monitoring.shards'} | ${-1} | ${"Value should be greater or equal than 1."}
+ ${'wazuh.monitoring.shards'} | ${'1.2'} | ${'Number should be an integer.'}
+ ${'wazuh.monitoring.shards'} | ${1.2} | ${'Number should be an integer.'}
`('$setting | $value | $expectedValidation', ({ setting, value, expectedValidation }) => {
expect(
PLUGIN_SETTINGS[setting].validate(
diff --git a/common/services/settings-validator.ts b/common/services/settings-validator.ts
index 8b11ea7ef8..75fef368be 100644
--- a/common/services/settings-validator.ts
+++ b/common/services/settings-validator.ts
@@ -56,14 +56,17 @@ export class SettingsValidator {
* @param options
* @returns
*/
- static multipleLinesString(options: { min?: number, max?: number } = {}) {
+ static multipleLinesString(options: { min?: number, max?: number, maxLength?: number } = {}) {
return function (value: number) {
const lines = value.split(/\r\n|\r|\n/).length;
+ if (typeof options.maxLength !== 'undefined' && value.split('\n').some(line => line.length > options.maxLength)) {
+ return `The maximum length of a line is ${options.maxLength} characters.`;
+ };
if (typeof options.min !== 'undefined' && lines < options.min) {
return `The string should have more or ${options.min} line/s.`;
};
if (typeof options.max !== 'undefined' && lines > options.max) {
- return `The string should have less or ${options.max} line/s.`;
+ return `The string should have less or equal to ${options.max} line/s.`;
};
}
};
diff --git a/public/components/common/form/__snapshots__/index.test.tsx.snap b/public/components/common/form/__snapshots__/index.test.tsx.snap
index 1423f32943..fc905bae31 100644
--- a/public/components/common/form/__snapshots__/index.test.tsx.snap
+++ b/public/components/common/form/__snapshots__/index.test.tsx.snap
@@ -412,3 +412,14 @@ exports[`[component] InputForm Renders correctly to match the snapshot: Input: t
`;
+
+exports[`[component] InputForm Renders correctly to match the snapshot: Input: textarea 1`] = `
+
+
+
+`;
diff --git a/public/components/common/form/index.test.tsx b/public/components/common/form/index.test.tsx
index 6c5ba70ac9..670bdca64d 100644
--- a/public/components/common/form/index.test.tsx
+++ b/public/components/common/form/index.test.tsx
@@ -14,13 +14,14 @@ describe('[component] InputForm', () => {
const optionsSelect = { select: [{ text: 'Label1', value: 'value1' }, { text: 'Label2', value: 'value2' }] };
const optionsSwitch = { switch: { values: { enabled: { label: 'Enabled', value: true }, disabled: { label: 'Disabled', value: false } } } };
it.each`
- inputType | value | options
- ${'editor'} | ${'{}'} | ${optionsEditor}
- ${'filepicker'} | ${'{}'} | ${optionsFilepicker}
- ${'number'} | ${4} | ${undefined}
- ${'select'} | ${'value1'} | ${optionsSelect}
- ${'switch'} | ${true} | ${optionsSwitch}
- ${'text'} | ${'test'} | ${undefined}
+ inputType | value | options
+ ${'editor'} | ${'{}'} | ${optionsEditor}
+ ${'filepicker'} | ${'{}'} | ${optionsFilepicker}
+ ${'number'} | ${4} | ${undefined}
+ ${'select'} | ${'value1'} | ${optionsSelect}
+ ${'switch'} | ${true} | ${optionsSwitch}
+ ${'text'} | ${'test'} | ${undefined}
+ ${'textarea'} | ${'test'} | ${undefined}
`('Renders correctly to match the snapshot: Input: $inputType', ({ inputType, value, options }) => {
const wrapper = render(
{
+ return (
+
+ );
+};
diff --git a/public/components/settings/configuration/components/categories/components/category/category.tsx b/public/components/settings/configuration/components/categories/components/category/category.tsx
index 4aaca2ab08..67fc5184ee 100644
--- a/public/components/settings/configuration/components/categories/components/category/category.tsx
+++ b/public/components/settings/configuration/components/categories/components/category/category.tsx
@@ -117,7 +117,6 @@ export const Category: React.FunctionComponent = ({
aria-label={item.key}
content='Invalid' />
)}
-
{isUpdated && (
{
// Update the settings that uploads a file
if(Object.keys(settingsToUpdate.fileUpload).length){
requests.push(...Object.entries(settingsToUpdate.fileUpload)
- .map(([pluginSettingKey, {file, extension}]) => {
+ .map(([pluginSettingKey, {file}]) => {
// Create the form data
const formData = new FormData();
formData.append('file', file);
diff --git a/server/controllers/wazuh-reporting.ts b/server/controllers/wazuh-reporting.ts
index 417eeda095..65bd8ac66f 100644
--- a/server/controllers/wazuh-reporting.ts
+++ b/server/controllers/wazuh-reporting.ts
@@ -66,9 +66,9 @@ export class WazuhReportingCtrl {
str += `${
type === 'range'
? `${params.gte}-${params.lt}`
- : type === 'phrases'
- ? '(' + params.join(" OR ") + ')'
- : type === 'exists'
+ : type === 'phrases'
+ ? '(' + params.join(" OR ") + ')'
+ : type === 'exists'
? '*'
: !!value
? value
diff --git a/server/lib/reporting/printer.ts b/server/lib/reporting/printer.ts
index 7a2e09dba8..ff1f1d247a 100644
--- a/server/lib/reporting/printer.ts
+++ b/server/lib/reporting/printer.ts
@@ -10,13 +10,14 @@ import {
import { log } from '../logger';
import * as TimSort from 'timsort';
import { getConfiguration } from '../get-configuration';
-import { REPORTS_PRIMARY_COLOR, REPORTS_LOGO_IMAGE_ASSETS_RELATIVE_PATH, REPORTS_PAGE_FOOTER_TEXT, REPORTS_PAGE_HEADER_TEXT } from '../../../common/constants';
+import { REPORTS_PRIMARY_COLOR} from '../../../common/constants';
+import { getSettingDefaultValue } from '../../../common/services/settings';
const COLORS = {
PRIMARY: REPORTS_PRIMARY_COLOR
};
-const pageConfiguration = (nameLogo) => ({
+const pageConfiguration = ({ pathToLogo, pageHeader, pageFooter }) => ({
styles: {
h1: {
fontSize: 22,
@@ -54,11 +55,11 @@ const pageConfiguration = (nameLogo) => ({
margin: [40, 20, 0, 0],
columns: [
{
- image: path.join(__dirname, `../../../public/assets/${nameLogo}`),
- width: 190
+ image: path.join(__dirname, `../../../public/assets/${pathToLogo}`),
+ fit: [190, 50]
},
{
- text: REPORTS_PAGE_HEADER_TEXT,
+ text: pageHeader,
alignment: 'right',
margin: [0, 0, 40, 0],
color: COLORS.PRIMARY
@@ -70,7 +71,7 @@ const pageConfiguration = (nameLogo) => ({
return {
columns: [
{
- text: REPORTS_PAGE_FOOTER_TEXT,
+ text: pageFooter,
color: COLORS.PRIMARY,
margin: [40, 40, 0, 0]
},
@@ -473,7 +474,7 @@ export class ReportPrinter{
this.addContent(typeof title === 'string' ? { text: title, style: 'h4' } : title)
.addNewLine();
}
-
+
if (!items || !items.length) {
this.addContent({
text: 'No results match your search criteria',
@@ -494,23 +495,23 @@ export class ReportPrinter{
style: 'standard'
}
})
- });
+ });
// 385 is the max initial width per column
let totalLength = columns.length - 1;
const widthColumn = 385/totalLength;
let totalWidth = totalLength * widthColumn;
-
+
const widths:(number)[] = [];
-
+
for (let step = 0; step < columns.length - 1; step++) {
let columnLength = this.getColumnWidth(columns[step], tableRows, step);
-
+
if (columnLength <= Math.round(totalWidth / totalLength)) {
widths.push(columnLength);
totalWidth -= columnLength;
- }
+ }
else {
widths.push(Math.round(totalWidth / totalLength));
totalWidth -= Math.round((totalWidth / totalLength));
@@ -518,7 +519,7 @@ export class ReportPrinter{
totalLength--;
}
widths.push('*');
-
+
this.addContent({
fontSize: 8,
table: {
@@ -562,9 +563,9 @@ export class ReportPrinter{
`agents: ${agents}`,
'debug'
);
-
+
this.addNewLine();
-
+
this.addContent({
text:
'NOTE: This report only includes the authorized agents of the user who generated the report',
@@ -613,22 +614,36 @@ export class ReportPrinter{
);
}
- async print(reportPath: string){
- const nameLogo = ( await getConfiguration() )['customization.logo.reports'] || REPORTS_LOGO_IMAGE_ASSETS_RELATIVE_PATH;
+ async print(reportPath: string) {
+ return new Promise((resolve, reject) => {
+ try {
+ const configuration = getConfiguration();
- const document = this._printer.createPdfKitDocument({...pageConfiguration(nameLogo), content: this._content});
- await document.pipe(
- fs.createWriteStream(reportPath)
- );
- document.end();
+ const pathToLogo = configuration['customization.logo.reports'] || getSettingDefaultValue('customization.logo.reports');
+ const pageHeader = configuration['customization.reports.header'] || getSettingDefaultValue('customization.reports.header');
+ const pageFooter = configuration['customization.reports.footer'] || getSettingDefaultValue('customization.reports.footer');
+
+ const document = this._printer.createPdfKitDocument({ ...pageConfiguration({ pathToLogo, pageHeader, pageFooter }), content: this._content });
+
+ document.on('error', reject);
+ document.on('end', resolve);
+
+ document.pipe(
+ fs.createWriteStream(reportPath)
+ );
+ document.end();
+ } catch (ex) {
+ reject(ex);
+ }
+ });
}
/**
* Returns the width of a given column
- *
- * @param column
- * @param tableRows
- * @param step
+ *
+ * @param column
+ * @param tableRows
+ * @param step
* @returns {number}
*/
getColumnWidth(column, tableRows, index){
diff --git a/server/routes/wazuh-reporting.test.ts b/server/routes/wazuh-reporting.test.ts
index b56ea7b2ff..a9da7ffc64 100644
--- a/server/routes/wazuh-reporting.test.ts
+++ b/server/routes/wazuh-reporting.test.ts
@@ -1,96 +1,237 @@
// To launch this file
// yarn test:jest --testEnvironment node --verbose server/routes/wazuh-reporting
-import axios from 'axios';
-import { PLUGIN_PLATFORM_REQUEST_HEADERS } from '../../common/constants';
-
-function buildAxiosOptions(method: string, path: string, data: any = {}, headers: any = {}){
- return {
- method: method,
- headers: { ...PLUGIN_PLATFORM_REQUEST_HEADERS, 'content-type': 'application/json', ...headers },
- url: `http://localhost:5601${path}`,
- data: data
- };
+import { Router } from '../../../../src/core/server/http/router/router';
+import { HttpServer } from '../../../../src/core/server/http/http_server';
+import { loggingSystemMock } from '../../../../src/core/server/logging/logging_system.mock';
+import { ByteSizeValue } from '@kbn/config-schema';
+import supertest from 'supertest';
+import { WazuhUtilsRoutes } from './wazuh-utils';
+import { WazuhReportingRoutes } from './wazuh-reporting';
+import { WazuhUtilsCtrl } from '../controllers/wazuh-utils/wazuh-utils';
+import md5 from 'md5';
+import path from 'path';
+import { createDataDirectoryIfNotExists, createDirectoryIfNotExists } from '../lib/filesystem';
+import {
+ WAZUH_DATA_CONFIG_APP_PATH,
+ WAZUH_DATA_CONFIG_DIRECTORY_PATH,
+ WAZUH_DATA_DOWNLOADS_REPORTS_DIRECTORY_PATH,
+ WAZUH_DATA_LOGS_DIRECTORY_PATH,
+ WAZUH_DATA_ABSOLUTE_PATH,
+ WAZUH_DATA_DOWNLOADS_DIRECTORY_PATH
+} from '../../common/constants';
+import { execSync } from 'child_process';
+import fs from 'fs';
+import moment from 'moment';
+import { of } from 'rxjs';
+
+jest.mock('../lib/reporting/extended-information', () => ({
+ extendedInformation: jest.fn()
+}));
+const USER_NAME = 'admin';
+const loggingService = loggingSystemMock.create();
+const logger = loggingService.get();
+const context = {
+ wazuh: {
+ security: {
+ getCurrentUser: (request) => {
+ // x-test-username header doesn't exist when the platform or plugin are running.
+ // It is used to generate the output of this method so we can simulate the user
+ // that does the request to the endpoint and is expected by the endpoint handlers
+ // of the plugin.
+ const username = request.headers['x-test-username'];
+ return { username, hashUsername: md5(username) }
+ }
+ }
+ }
};
+const enhanceWithContext = (fn: (...args: any[]) => any) => fn.bind(null, context);
+let server, innerServer;
+
+// BEFORE ALL
+beforeAll(async () => {
+ // Create /data/wazuh directory.
+ createDataDirectoryIfNotExists();
+
+ // Create /data/wazuh/config directory.
+ createDirectoryIfNotExists(WAZUH_DATA_CONFIG_DIRECTORY_PATH);
+
+ // Create /data/wazuh/logs directory.
+ createDirectoryIfNotExists(WAZUH_DATA_LOGS_DIRECTORY_PATH);
+
+ // Create server
+ const config = {
+ name: 'plugin_platform',
+ host: '127.0.0.1',
+ maxPayload: new ByteSizeValue(1024),
+ port: 10002,
+ ssl: { enabled: false },
+ compression: { enabled: true },
+ requestId: {
+ allowFromAnyIp: true,
+ ipAllowlist: [],
+ },
+ cors: {
+ enabled: false,
+ },
+ shutdownTimeout: moment.duration(500, 'ms'),
+ } as any;
+ server = new HttpServer(loggingService, 'tests', of(config.shutdownTimeout));
+ const router = new Router('', logger, enhanceWithContext);
+ const { registerRouter, server: innerServerTest, ...rest } = await server.setup(config);
+ innerServer = innerServerTest;
+
+ // Mock decorator
+ jest.spyOn(WazuhUtilsCtrl.prototype as any, 'routeDecoratorProtectedAdministratorRoleValidToken')
+ .mockImplementation((handler) => async (...args) => handler(...args));
+
+ // Register routes
+ WazuhUtilsRoutes(router);
+ WazuhReportingRoutes(router);
+
+ // Register router
+ registerRouter(router);
+
+ // start server
+ await server.start();
+});
+
+afterAll(async () => {
+ // Stop server
+ await server.stop();
+
+ // Clear all mocks
+ jest.clearAllMocks();
+
+ // Remove /data/wazuh directory.
+ execSync(`rm -rf ${WAZUH_DATA_ABSOLUTE_PATH}`);
+});
+
+describe('[endpoint] GET /reports', () => {
+ const directories = [
+ { username: 'admin', files: 0 },
+ { username: '../../etc', files: 1 },
+ ];
+ beforeAll(() => {
+ // Create /data/wazuh directory.
+ createDataDirectoryIfNotExists();
+
+ // Create /data/wazuh/config directory.
+ createDirectoryIfNotExists(WAZUH_DATA_CONFIG_DIRECTORY_PATH);
+
+ // Create /data/wazuh/logs directory.
+ createDirectoryIfNotExists(WAZUH_DATA_LOGS_DIRECTORY_PATH);
+
+ // Create /data/wazuh/downloads directory.
+ createDirectoryIfNotExists(WAZUH_DATA_DOWNLOADS_DIRECTORY_PATH);
+
+ // Create /data/wazuh/downloads/reports directory.
+ createDirectoryIfNotExists(WAZUH_DATA_DOWNLOADS_REPORTS_DIRECTORY_PATH);
-describe.skip('Wazuh Reporting', () => {
- describe('Wazuh API - /reports', () => {
- test('[200] Returns the available reports for user', () => {
- const options = buildAxiosOptions('get', '/reports', {}, {
- cookie: 'wz-user=elastic'
- });
- return axios(options).then(response => {
- expect(response.status).toBe(200);
- expect(Array.isArray(response.data.reports)).toBe(true);
- }).catch(error => {throw error})
+ // Create directories and file/s within directory.
+ directories.forEach(({ username, files }) => {
+ const hashUsername = md5(username);
+ createDirectoryIfNotExists(path.join(WAZUH_DATA_DOWNLOADS_REPORTS_DIRECTORY_PATH, hashUsername));
+ if (files) {
+ Array.from(Array(files).keys()).forEach(indexFile => {
+ console.log('Generating', username, indexFile)
+ fs.closeSync(fs.openSync(path.join(WAZUH_DATA_DOWNLOADS_REPORTS_DIRECTORY_PATH, hashUsername, `report_${indexFile}.pdf`), 'w'));
+ });
+ }
});
});
- //TODO: do the test for these endpoints
- // describe('Wazuh API - /reports/{name}', () => {
- // test('[200] Returns the available reports for user and name', () => {
- // const options = buildAxiosOptions('get', '/reports/wazuh-report.pdf', {}, {
- // cookie: 'wz-user=elastic'
- // });
- // return axios(options).then(response => {
- // expect(response.status).toBe(200);
- // expect(Array.isArray(response.data.reports)).toBe(true);
- // }).catch(error => {throw error})
- // });
-
- // test('[200] Returns the available reports for user and name', () => {
- // const options = buildAxiosOptions('delete', '/reports/wazuh-report.pdf', {}, {
- // cookie: 'wz-user=elastic'
- // });
- // return axios(options).then(response => {
- // }).catch(error => {throw error})
- // });
- // });
-
- // describe('Wazuh API - /reports/modules/{moduleID}', () => {
- // test('[200] Generates a modules reports the available reports for user and name', () => {
- // const options = buildAxiosOptions('post', '/reports/modules/{moduleID}', {}, {
- // cookie: 'wz-user=elastic'
- // });
- // return axios(options).then(response => {
- // expect(response.status).toBe(200);
- // expect(Array.isArray(response.data.reports)).toBe(true);
- // }).catch(error => {throw error})
- // });
- // });
-
- // describe('Wazuh API - /reports/groups/{groupID}', () => {
- // test('[200] Generates a modules reports the available reports for user and name', () => {
- // const options = buildAxiosOptions('post', '/reports/groups/{groupID}', {}, {
- // cookie: 'wz-user=elastic'
- // });
- // return axios(options).then(response => {
- // expect(response.status).toBe(200);
- // expect(Array.isArray(response.data.reports)).toBe(true);
- // }).catch(error => {throw error})
- // });
- // });
-
- // describe('Wazuh API - /reports/agents/{agentID}', () => {
- // test('[200] Generates a modules reports the available reports for user and name', () => {
- // const options = buildAxiosOptions('post', '/reports/agents/{agentID}', {}, {
- // cookie: 'wz-user=elastic'
- // });
- // return axios(options).then(response => {
- // expect(response.status).toBe(200);
- // expect(Array.isArray(response.data.reports)).toBe(true);
- // }).catch(error => {throw error})
- // });
- // });
-
- // describe('Wazuh API - /reports/agents/{agentID}/inventory', () => {
- // test('[200] Generates a modules reports the available reports for user and name', () => {
- // const options = buildAxiosOptions('post', '/reports/agents/{agentID}/inventory', {}, {
- // cookie: 'wz-user=elastic'
- // });
- // return axios(options).then(response => {
- // expect(response.status).toBe(200);
- // expect(Array.isArray(response.data.reports)).toBe(true);
- // }).catch(error => {throw error})
- // });
- // });
+ afterAll(async () => {
+ // Remove /data/wazuh/downloads directory.
+ execSync(`rm -rf ${WAZUH_DATA_DOWNLOADS_DIRECTORY_PATH}`);
+ });
+
+ it.each(directories)('get reports of $username. status response: $responseStatus', async ({ username, files }) => {
+ const response = await supertest(innerServer.listener)
+ .get(`/reports`)
+ .set('x-test-username', username)
+ .expect(200);
+ expect(response.body.reports).toHaveLength(files);
+ });
+});
+
+describe('[endpoint] PUT /utils/configuration', () => {
+ beforeEach(() => {
+ // Create the configuration file with custom content
+ const fileContent = `---
+ pattern: test-alerts-*
+
+ hosts:
+ - default:
+ url: https://localhost
+ port: 55000
+ username: wazuh-wui
+ password: wazuh-wui
+ run_as: false
+ `;
+
+ fs.writeFileSync(WAZUH_DATA_CONFIG_APP_PATH, fileContent, 'utf8');
+ });
+
+ afterEach(() => {
+ // Remove the configuration file
+ fs.unlinkSync(WAZUH_DATA_CONFIG_APP_PATH);
+ });
+
+ // expectedMD5 variable is a verified md5 of a report generated with this header and footer
+ // If any of the parameters is changed this variable should be updated with the new md5
+ it.each`
+ footer | header | responseStatusCode | expectedMD5 | tab
+ ${null} | ${null} | ${200} | ${'9fbdebb41c6c4fe09841fc94a14de174'} | ${'pm'}
+ ${'Custom\nFooter'} | ${'info@company.com\nFake Avenue 123'}| ${200} | ${'f01f3aa26436cca6c92e7c45da72efce'} | ${'general'}
+ ${''} | ${''} | ${200} | ${'fa6c0527535b314aaf50d27e98fda093'} | ${'fim'}
+ ${'Custom Footer'} | ${null} | ${200} | ${'e4aba02dcb618387a4da4103ce833238'} | ${'aws'}
+ ${null} | ${'Custom Header'} | ${200} | ${'102c342384edd4796a02045e28f970cd'} | ${'gcp'}
+`(`Set custom report header and footer - Verify PDF output`, async ({footer, header, responseStatusCode, expectedMD5, tab}) => {
+
+ // Mock PDF report parameters
+ const reportBody = { "array": [], "filters": [], "time": { "from": '2022-10-01T09:59:40.825Z', "to": '2022-10-04T09:59:40.825Z' }, "searchBar": "", "tables": [], "tab": tab, "section": "overview", "agents": false, "browserTimezone": "Europe/Madrid", "indexPatternTitle": "wazuh-alerts-*", "apiId": "default" };
+
+ // Define custom configuration
+ const configurationBody = {};
+
+ if (typeof footer == 'string') {
+ configurationBody['customization.reports.footer'] = footer;
+ }
+ if (typeof header == 'string') {
+ configurationBody['customization.reports.header'] = header;
+ }
+
+ // Set custom report header and footer
+ if (typeof footer == 'string' || typeof header == 'string') {
+ const responseConfig = await supertest(innerServer.listener)
+ .put('/utils/configuration')
+ .send(configurationBody)
+ .expect(responseStatusCode);
+
+ if (typeof footer == 'string') {
+ expect(responseConfig.body?.data?.updatedConfiguration?.['customization.reports.footer']).toMatch(configurationBody['customization.reports.footer']);
+ }
+ if (typeof header == 'string') {
+ expect(responseConfig.body?.data?.updatedConfiguration?.['customization.reports.header']).toMatch(configurationBody['customization.reports.header']);
+ }
+ }
+
+ // Generate PDF report
+ const responseReport = await supertest(innerServer.listener)
+ .post(`/reports/modules/${tab}`)
+ .set('x-test-username', USER_NAME)
+ .send(reportBody)
+ .expect(200);
+ const fileName = responseReport.body?.message.match(/([A-Z-0-9]*\.pdf)/gi)[0];
+ const userPath = md5(USER_NAME);
+ const reportPath = `${WAZUH_DATA_DOWNLOADS_REPORTS_DIRECTORY_PATH}/${userPath}/${fileName}`;
+ const PDFbuffer = fs.readFileSync(reportPath);
+ const PDFcontent = PDFbuffer.toString('utf8');
+ const content = PDFcontent
+ .replace(/\[<[a-z0-9].+> <[a-z0-9].+>\]/gi, '')
+ .replace(/(obj\n\(D:[0-9].+Z\)\nendobj)/gi, '');
+ const PDFmd5 = md5(content);
+
+ expect(PDFmd5).toBe(expectedMD5);
+ });
});
diff --git a/server/routes/wazuh-utils/wazuh-utils.test.ts b/server/routes/wazuh-utils/wazuh-utils.test.ts
index ce0ed7d0a1..7c189a6fc4 100644
--- a/server/routes/wazuh-utils/wazuh-utils.test.ts
+++ b/server/routes/wazuh-utils/wazuh-utils.test.ts
@@ -145,8 +145,8 @@ hosts:
});
it.each`
- settings | responseStatusCode
- ${{ pattern: 'test-alerts-groupA-*' }} | ${200}
+ settings | responseStatusCode
+ ${{ pattern: 'test-alerts-groupA-*' }} | ${200}
${{ pattern: 'test-alerts-groupA-*', 'logs.level': 'debug' }} | ${200}
`(`Update the plugin configuration: $settings. PUT /utils/configuration - $responseStatusCode`, async ({ responseStatusCode, settings }) => {
const response = await supertest(innerServer.listener)
@@ -211,217 +211,229 @@ hosts:
});
it.each`
- setting | value | responseStatusCode | responseBodyMessage
- ${'alerts.sample.prefix'} | ${'test'} | ${200} | ${null}
- ${'alerts.sample.prefix'} | ${''} | ${400} | ${"[request body.alerts.sample.prefix]: Value can not be empty."}
- ${'alerts.sample.prefix'} | ${'test space'} | ${400} | ${"[request body.alerts.sample.prefix]: No whitespaces allowed."}
- ${'alerts.sample.prefix'} | ${4} | ${400} | ${'[request body.alerts.sample.prefix]: expected value of type [string] but got [number]'}
- ${'alerts.sample.prefix'} | ${'-test'} | ${400} | ${"[request body.alerts.sample.prefix]: It can't start with: -, _, +, .."}
- ${'alerts.sample.prefix'} | ${'_test'} | ${400} | ${"[request body.alerts.sample.prefix]: It can't start with: -, _, +, .."}
- ${'alerts.sample.prefix'} | ${'+test'} | ${400} | ${"[request body.alerts.sample.prefix]: It can't start with: -, _, +, .."}
- ${'alerts.sample.prefix'} | ${'.test'} | ${400} | ${"[request body.alerts.sample.prefix]: It can't start with: -, _, +, .."}
- ${'alerts.sample.prefix'} | ${'test\\'} | ${400} | ${"[request body.alerts.sample.prefix]: It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
- ${'alerts.sample.prefix'} | ${'test/'} | ${400} | ${"[request body.alerts.sample.prefix]: It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
- ${'alerts.sample.prefix'} | ${'test?'} | ${400} | ${"[request body.alerts.sample.prefix]: It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
- ${'alerts.sample.prefix'} | ${'test"'} | ${400} | ${"[request body.alerts.sample.prefix]: It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
- ${'alerts.sample.prefix'} | ${'test<'} | ${400} | ${"[request body.alerts.sample.prefix]: It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
- ${'alerts.sample.prefix'} | ${'test>'} | ${400} | ${"[request body.alerts.sample.prefix]: It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
- ${'alerts.sample.prefix'} | ${'test|'} | ${400} | ${"[request body.alerts.sample.prefix]: It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
- ${'alerts.sample.prefix'} | ${'test,'} | ${400} | ${"[request body.alerts.sample.prefix]: It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
- ${'alerts.sample.prefix'} | ${'test#'} | ${400} | ${"[request body.alerts.sample.prefix]: It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
- ${'alerts.sample.prefix'} | ${'test*'} | ${400} | ${"[request body.alerts.sample.prefix]: It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
- ${'checks.api'} | ${true} | ${200} | ${null}
- ${'checks.api'} | ${0} | ${400} | ${'[request body.checks.api]: expected value of type [boolean] but got [number]'}
- ${'checks.fields'} | ${true} | ${200} | ${null}
- ${'checks.fields'} | ${0} | ${400} | ${'[request body.checks.fields]: expected value of type [boolean] but got [number]'}
- ${'checks.maxBuckets'} | ${true} | ${200} | ${null}
- ${'checks.maxBuckets'} | ${0} | ${400} | ${'[request body.checks.maxBuckets]: expected value of type [boolean] but got [number]'}
- ${'checks.pattern'} | ${true} | ${200} | ${null}
- ${'checks.pattern'} | ${0} | ${400} | ${'[request body.checks.pattern]: expected value of type [boolean] but got [number]'}
- ${'checks.setup'} | ${true} | ${200} | ${null}
- ${'checks.setup'} | ${0} | ${400} | ${'[request body.checks.setup]: expected value of type [boolean] but got [number]'}
- ${'checks.template'} | ${true} | ${200} | ${null}
- ${'checks.template'} | ${0} | ${400} | ${'[request body.checks.template]: expected value of type [boolean] but got [number]'}
- ${'checks.timeFilter'} | ${true} | ${200} | ${null}
- ${'checks.timeFilter'} | ${0} | ${400} | ${'[request body.checks.timeFilter]: expected value of type [boolean] but got [number]'}
- ${'cron.prefix'} | ${'test'} | ${200} | ${null}
- ${'cron.prefix'} | ${'test space'} | ${400} | ${"[request body.cron.prefix]: No whitespaces allowed."}
- ${'cron.prefix'} | ${''} | ${400} | ${"[request body.cron.prefix]: Value can not be empty."}
- ${'cron.prefix'} | ${4} | ${400} | ${'[request body.cron.prefix]: expected value of type [string] but got [number]'}
- ${'cron.prefix'} | ${'-test'} | ${400} | ${"[request body.cron.prefix]: It can't start with: -, _, +, .."}
- ${'cron.prefix'} | ${'_test'} | ${400} | ${"[request body.cron.prefix]: It can't start with: -, _, +, .."}
- ${'cron.prefix'} | ${'+test'} | ${400} | ${"[request body.cron.prefix]: It can't start with: -, _, +, .."}
- ${'cron.prefix'} | ${'.test'} | ${400} | ${"[request body.cron.prefix]: It can't start with: -, _, +, .."}
- ${'cron.prefix'} | ${'test\\'} | ${400} | ${"[request body.cron.prefix]: It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
- ${'cron.prefix'} | ${'test/'} | ${400} | ${"[request body.cron.prefix]: It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
- ${'cron.prefix'} | ${'test?'} | ${400} | ${"[request body.cron.prefix]: It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
- ${'cron.prefix'} | ${'test"'} | ${400} | ${"[request body.cron.prefix]: It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
- ${'cron.prefix'} | ${'test<'} | ${400} | ${"[request body.cron.prefix]: It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
- ${'cron.prefix'} | ${'test>'} | ${400} | ${"[request body.cron.prefix]: It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
- ${'cron.prefix'} | ${'test|'} | ${400} | ${"[request body.cron.prefix]: It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
- ${'cron.prefix'} | ${'test,'} | ${400} | ${"[request body.cron.prefix]: It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
- ${'cron.prefix'} | ${'test#'} | ${400} | ${"[request body.cron.prefix]: It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
- ${'cron.prefix'} | ${'test*'} | ${400} | ${"[request body.cron.prefix]: It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
- ${'cron.statistics.apis'} | ${['test']} | ${200} | ${null}
- ${'cron.statistics.apis'} | ${['test ']} | ${400} | ${"[request body.cron.statistics.apis.0]: No whitespaces allowed."}
- ${'cron.statistics.apis'} | ${['']} | ${400} | ${"[request body.cron.statistics.apis.0]: Value can not be empty."}
- ${'cron.statistics.apis'} | ${['test', 4]} | ${400} | ${"[request body.cron.statistics.apis.1]: expected value of type [string] but got [number]"}
- ${'cron.statistics.apis'} | ${'test space'} | ${400} | ${"[request body.cron.statistics.apis]: could not parse array value from json input"}
- ${'cron.statistics.apis'} | ${true} | ${400} | ${"[request body.cron.statistics.apis]: expected value of type [array] but got [boolean]"}
- ${'cron.statistics.index.creation'} | ${'h'} | ${200} | ${null}
- ${'cron.statistics.index.creation'} | ${'d'} | ${200} | ${null}
- ${'cron.statistics.index.creation'} | ${'w'} | ${200} | ${null}
- ${'cron.statistics.index.creation'} | ${'m'} | ${200} | ${null}
- ${'cron.statistics.index.creation'} | ${'test'} | ${400} | ${"[request body.cron.statistics.index.creation]: types that failed validation:\n- [request body.cron.statistics.index.creation.0]: expected value to equal [h]\n- [request body.cron.statistics.index.creation.1]: expected value to equal [d]\n- [request body.cron.statistics.index.creation.2]: expected value to equal [w]\n- [request body.cron.statistics.index.creation.3]: expected value to equal [m]"}
- ${'cron.statistics.index.name'} | ${'test'} | ${200} | ${null}
- ${'cron.statistics.index.name'} | ${''} | ${400} | ${"[request body.cron.statistics.index.name]: Value can not be empty."}
- ${'cron.statistics.index.name'} | ${'test space'} | ${400} | ${"[request body.cron.statistics.index.name]: No whitespaces allowed."}
- ${'cron.statistics.index.name'} | ${true} | ${400} | ${"[request body.cron.statistics.index.name]: expected value of type [string] but got [boolean]"}
- ${'cron.statistics.index.name'} | ${'-test'} | ${400} | ${"[request body.cron.statistics.index.name]: It can't start with: -, _, +, .."}
- ${'cron.statistics.index.name'} | ${'_test'} | ${400} | ${"[request body.cron.statistics.index.name]: It can't start with: -, _, +, .."}
- ${'cron.statistics.index.name'} | ${'+test'} | ${400} | ${"[request body.cron.statistics.index.name]: It can't start with: -, _, +, .."}
- ${'cron.statistics.index.name'} | ${'.test'} | ${400} | ${"[request body.cron.statistics.index.name]: It can't start with: -, _, +, .."}
- ${'cron.statistics.index.name'} | ${'test\\'} | ${400} | ${"[request body.cron.statistics.index.name]: It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
- ${'cron.statistics.index.name'} | ${'test/'} | ${400} | ${"[request body.cron.statistics.index.name]: It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
- ${'cron.statistics.index.name'} | ${'test?'} | ${400} | ${"[request body.cron.statistics.index.name]: It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
- ${'cron.statistics.index.name'} | ${'test"'} | ${400} | ${"[request body.cron.statistics.index.name]: It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
- ${'cron.statistics.index.name'} | ${'test<'} | ${400} | ${"[request body.cron.statistics.index.name]: It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
- ${'cron.statistics.index.name'} | ${'test>'} | ${400} | ${"[request body.cron.statistics.index.name]: It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
- ${'cron.statistics.index.name'} | ${'test|'} | ${400} | ${"[request body.cron.statistics.index.name]: It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
- ${'cron.statistics.index.name'} | ${'test,'} | ${400} | ${"[request body.cron.statistics.index.name]: It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
- ${'cron.statistics.index.name'} | ${'test#'} | ${400} | ${"[request body.cron.statistics.index.name]: It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
- ${'cron.statistics.index.name'} | ${'test*'} | ${400} | ${"[request body.cron.statistics.index.name]: It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
- ${'cron.statistics.index.replicas'} | ${0} | ${200} | ${null}
- ${'cron.statistics.index.replicas'} | ${-1} | ${400} | ${"[request body.cron.statistics.index.replicas]: Value should be greater or equal than 0."}
- ${'cron.statistics.index.replicas'} | ${'custom'} | ${400} | ${"[request body.cron.statistics.index.replicas]: expected value of type [number] but got [string]"}
- ${'cron.statistics.index.replicas'} | ${1.2} | ${400} | ${"[request body.cron.statistics.index.replicas]: Number should be an integer."}
- ${'cron.statistics.index.shards'} | ${1} | ${200} | ${null}
- ${'cron.statistics.index.shards'} | ${-1} | ${400} | ${"[request body.cron.statistics.index.shards]: Value should be greater or equal than 1."}
- ${'cron.statistics.index.shards'} | ${1.2} | ${400} | ${"[request body.cron.statistics.index.shards]: Number should be an integer."}
- ${'cron.statistics.interval'} | ${'0 */5 * * * *'} | ${200} | ${null}
- ${'cron.statistics.interval'} | ${'0 */5 * * *'} | ${200} | ${null}
- ${'cron.statistics.interval'} | ${'custom'} | ${400} | ${"[request body.cron.statistics.interval]: Interval is not valid."}
- ${'cron.statistics.interval'} | ${true} | ${400} | ${"[request body.cron.statistics.interval]: expected value of type [string] but got [boolean]"}
- ${'cron.statistics.status'} | ${true} | ${200} | ${null}
- ${'cron.statistics.status'} | ${0} | ${400} | ${'[request body.cron.statistics.status]: expected value of type [boolean] but got [number]'}
- ${'disabled_roles'} | ${['test']} | ${200} | ${null}
- ${'disabled_roles'} | ${['']} | ${400} | ${'[request body.disabled_roles.0]: Value can not be empty.'}
- ${'disabled_roles'} | ${['test space']} | ${400} | ${"[request body.disabled_roles.0]: No whitespaces allowed."}
- ${'disabled_roles'} | ${['test', 4]} | ${400} | ${"[request body.disabled_roles.1]: expected value of type [string] but got [number]"}
- ${'enrollment.dns'} | ${'test'} | ${200} | ${null}
- ${'enrollment.dns'} | ${''} | ${200} | ${null}
- ${'enrollment.dns'} | ${'test space'} | ${400} | ${"[request body.enrollment.dns]: No whitespaces allowed."}
- ${'enrollment.dns'} | ${true} | ${400} | ${'[request body.enrollment.dns]: expected value of type [string] but got [boolean]'}
- ${'enrollment.password'} | ${'test'} | ${200} | ${null}
- ${'enrollment.password'} | ${''} | ${400} | ${"[request body.enrollment.password]: Value can not be empty."}
- ${'enrollment.password'} | ${'test space'} | ${200} | ${null}
- ${'enrollment.password'} | ${true} | ${400} | ${'[request body.enrollment.password]: expected value of type [string] but got [boolean]'}
- ${'extensions.audit'} | ${true} | ${200} | ${null}
- ${'extensions.audit'} | ${0} | ${400} | ${'[request body.extensions.audit]: expected value of type [boolean] but got [number]'}
- ${'extensions.aws'} | ${true} | ${200} | ${null}
- ${'extensions.aws'} | ${0} | ${400} | ${'[request body.extensions.aws]: expected value of type [boolean] but got [number]'}
- ${'extensions.ciscat'} | ${true} | ${200} | ${null}
- ${'extensions.ciscat'} | ${0} | ${400} | ${'[request body.extensions.ciscat]: expected value of type [boolean] but got [number]'}
- ${'extensions.gcp'} | ${true} | ${200} | ${null}
- ${'extensions.gcp'} | ${0} | ${400} | ${'[request body.extensions.gcp]: expected value of type [boolean] but got [number]'}
- ${'extensions.gdpr'} | ${true} | ${200} | ${null}
- ${'extensions.gdpr'} | ${0} | ${400} | ${'[request body.extensions.gdpr]: expected value of type [boolean] but got [number]'}
- ${'extensions.hipaa'} | ${true} | ${200} | ${null}
- ${'extensions.hipaa'} | ${0} | ${400} | ${'[request body.extensions.hipaa]: expected value of type [boolean] but got [number]'}
- ${'extensions.nist'} | ${true} | ${200} | ${null}
- ${'extensions.nist'} | ${0} | ${400} | ${'[request body.extensions.nist]: expected value of type [boolean] but got [number]'}
- ${'extensions.oscap'} | ${true} | ${200} | ${null}
- ${'extensions.oscap'} | ${0} | ${400} | ${'[request body.extensions.oscap]: expected value of type [boolean] but got [number]'}
- ${'extensions.osquery'} | ${true} | ${200} | ${null}
- ${'extensions.osquery'} | ${0} | ${400} | ${'[request body.extensions.osquery]: expected value of type [boolean] but got [number]'}
- ${'extensions.pci'} | ${true} | ${200} | ${null}
- ${'extensions.pci'} | ${0} | ${400} | ${'[request body.extensions.pci]: expected value of type [boolean] but got [number]'}
- ${'extensions.tsc'} | ${true} | ${200} | ${null}
- ${'extensions.tsc'} | ${0} | ${400} | ${'[request body.extensions.tsc]: expected value of type [boolean] but got [number]'}
- ${'extensions.virustotal'} | ${true} | ${200} | ${null}
- ${'extensions.virustotal'} | ${0} | ${400} | ${'[request body.extensions.virustotal]: expected value of type [boolean] but got [number]'}
- ${'ip.ignore'} | ${['test']} | ${200} | ${null}
- ${'ip.ignore'} | ${['test*']} | ${200} | ${null}
- ${'ip.ignore'} | ${['']} | ${400} | ${'[request body.ip.ignore.0]: Value can not be empty.'}
- ${'ip.ignore'} | ${['test space']} | ${400} | ${"[request body.ip.ignore.0]: No whitespaces allowed."}
- ${'ip.ignore'} | ${true} | ${400} | ${"[request body.ip.ignore]: expected value of type [array] but got [boolean]"}
- ${'ip.ignore'} | ${['-test']} | ${400} | ${"[request body.ip.ignore.0]: It can't start with: -, _, +, .."}
- ${'ip.ignore'} | ${['_test']} | ${400} | ${"[request body.ip.ignore.0]: It can't start with: -, _, +, .."}
- ${'ip.ignore'} | ${['+test']} | ${400} | ${"[request body.ip.ignore.0]: It can't start with: -, _, +, .."}
- ${'ip.ignore'} | ${['.test']} | ${400} | ${"[request body.ip.ignore.0]: It can't start with: -, _, +, .."}
- ${'ip.ignore'} | ${['test\\']} | ${400} | ${"[request body.ip.ignore.0]: It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #."}
- ${'ip.ignore'} | ${['test/']} | ${400} | ${"[request body.ip.ignore.0]: It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #."}
- ${'ip.ignore'} | ${['test?']} | ${400} | ${"[request body.ip.ignore.0]: It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #."}
- ${'ip.ignore'} | ${['test"']} | ${400} | ${"[request body.ip.ignore.0]: It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #."}
- ${'ip.ignore'} | ${['test<']} | ${400} | ${"[request body.ip.ignore.0]: It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #."}
- ${'ip.ignore'} | ${['test>']} | ${400} | ${"[request body.ip.ignore.0]: It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #."}
- ${'ip.ignore'} | ${['test|']} | ${400} | ${"[request body.ip.ignore.0]: It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #."}
- ${'ip.ignore'} | ${['test,']} | ${400} | ${"[request body.ip.ignore.0]: It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #."}
- ${'ip.ignore'} | ${['test#']} | ${400} | ${"[request body.ip.ignore.0]: It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #."}
- ${'ip.ignore'} | ${['test', 'test#']} | ${400} | ${"[request body.ip.ignore.1]: It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #."}
- ${'ip.selector'} | ${true} | ${200} | ${null}
- ${'ip.selector'} | ${''} | ${400} | ${'[request body.ip.selector]: expected value of type [boolean] but got [string]'}
- ${'logs.level'} | ${'info'} | ${200} | ${null}
- ${'logs.level'} | ${'debug'} | ${200} | ${null}
- ${'logs.level'} | ${''} | ${400} | ${'[request body.logs.level]: types that failed validation:\n- [request body.logs.level.0]: expected value to equal [info]\n- [request body.logs.level.1]: expected value to equal [debug]'}
- ${'pattern'} | ${'test'} | ${200} | ${null}
- ${'pattern'} | ${'test*'} | ${200} | ${null}
- ${'pattern'} | ${''} | ${400} | ${'[request body.pattern]: Value can not be empty.'}
- ${'pattern'} | ${'test space'} | ${400} | ${"[request body.pattern]: No whitespaces allowed."}
- ${'pattern'} | ${true} | ${400} | ${'[request body.pattern]: expected value of type [string] but got [boolean]'}
- ${'pattern'} | ${'-test'} | ${400} | ${"[request body.pattern]: It can't start with: -, _, +, .."}
- ${'pattern'} | ${'_test'} | ${400} | ${"[request body.pattern]: It can't start with: -, _, +, .."}
- ${'pattern'} | ${'+test'} | ${400} | ${"[request body.pattern]: It can't start with: -, _, +, .."}
- ${'pattern'} | ${'.test'} | ${400} | ${"[request body.pattern]: It can't start with: -, _, +, .."}
- ${'pattern'} | ${'test\\'} | ${400} | ${"[request body.pattern]: It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #."}
- ${'pattern'} | ${'test/'} | ${400} | ${"[request body.pattern]: It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #."}
- ${'pattern'} | ${'test?'} | ${400} | ${"[request body.pattern]: It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #."}
- ${'pattern'} | ${'test"'} | ${400} | ${"[request body.pattern]: It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #."}
- ${'pattern'} | ${'test<'} | ${400} | ${"[request body.pattern]: It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #."}
- ${'pattern'} | ${'test>'} | ${400} | ${"[request body.pattern]: It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #."}
- ${'pattern'} | ${'test|'} | ${400} | ${"[request body.pattern]: It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #."}
- ${'pattern'} | ${'test,'} | ${400} | ${"[request body.pattern]: It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #."}
- ${'pattern'} | ${'test#'} | ${400} | ${"[request body.pattern]: It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #."}
- ${'timeout'} | ${15000} | ${200} | ${null}
- ${'timeout'} | ${1000} | ${400} | ${'[request body.timeout]: Value should be greater or equal than 1500.'}
- ${'timeout'} | ${''} | ${400} | ${'[request body.timeout]: expected value of type [number] but got [string]'}
- ${'timeout'} | ${1.2} | ${400} | ${"[request body.timeout]: Number should be an integer."}
- ${'wazuh.monitoring.creation'} | ${'h'} | ${200} | ${null}
- ${'wazuh.monitoring.creation'} | ${'d'} | ${200} | ${null}
- ${'wazuh.monitoring.creation'} | ${'w'} | ${200} | ${null}
- ${'wazuh.monitoring.creation'} | ${'m'} | ${200} | ${null}
- ${'wazuh.monitoring.creation'} | ${'test'} | ${400} | ${"[request body.wazuh.monitoring.creation]: types that failed validation:\n- [request body.wazuh.monitoring.creation.0]: expected value to equal [h]\n- [request body.wazuh.monitoring.creation.1]: expected value to equal [d]\n- [request body.wazuh.monitoring.creation.2]: expected value to equal [w]\n- [request body.wazuh.monitoring.creation.3]: expected value to equal [m]"}
- ${'wazuh.monitoring.enabled'} | ${true} | ${200} | ${null}
- ${'wazuh.monitoring.enabled'} | ${0} | ${400} | ${'[request body.wazuh.monitoring.enabled]: expected value of type [boolean] but got [number]'}
- ${'wazuh.monitoring.frequency'} | ${100} | ${200} | ${null}
- ${'wazuh.monitoring.frequency'} | ${40} | ${400} | ${"[request body.wazuh.monitoring.frequency]: Value should be greater or equal than 60."}
- ${'wazuh.monitoring.frequency'} | ${1.2} | ${400} | ${"[request body.wazuh.monitoring.frequency]: Number should be an integer."}
- ${'wazuh.monitoring.frequency'} | ${''} | ${400} | ${'[request body.wazuh.monitoring.frequency]: expected value of type [number] but got [string]'}
- ${'wazuh.monitoring.pattern'} | ${'test'} | ${200} | ${null}
- ${'wazuh.monitoring.pattern'} | ${'test*'} | ${200} | ${null}
- ${'wazuh.monitoring.pattern'} | ${''} | ${400} | ${'[request body.wazuh.monitoring.pattern]: value has length [0] but it must have a minimum length of [1].'}
- ${'wazuh.monitoring.pattern'} | ${true} | ${400} | ${'[request body.wazuh.monitoring.pattern]: expected value of type [string] but got [boolean]'}
- ${'wazuh.monitoring.pattern'} | ${'-test'} | ${400} | ${"[request body.wazuh.monitoring.pattern]: It can't start with: -, _, +, .."}
- ${'wazuh.monitoring.pattern'} | ${'_test'} | ${400} | ${"[request body.wazuh.monitoring.pattern]: It can't start with: -, _, +, .."}
- ${'wazuh.monitoring.pattern'} | ${'+test'} | ${400} | ${"[request body.wazuh.monitoring.pattern]: It can't start with: -, _, +, .."}
- ${'wazuh.monitoring.pattern'} | ${'.test'} | ${400} | ${"[request body.wazuh.monitoring.pattern]: It can't start with: -, _, +, .."}
- ${'wazuh.monitoring.pattern'} | ${'test\\'} | ${400} | ${"[request body.wazuh.monitoring.pattern]: It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #."}
- ${'wazuh.monitoring.pattern'} | ${'test/'} | ${400} | ${"[request body.wazuh.monitoring.pattern]: It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #."}
- ${'wazuh.monitoring.pattern'} | ${'test?'} | ${400} | ${"[request body.wazuh.monitoring.pattern]: It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #."}
- ${'wazuh.monitoring.pattern'} | ${'test"'} | ${400} | ${"[request body.wazuh.monitoring.pattern]: It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #."}
- ${'wazuh.monitoring.pattern'} | ${'test<'} | ${400} | ${"[request body.wazuh.monitoring.pattern]: It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #."}
- ${'wazuh.monitoring.pattern'} | ${'test>'} | ${400} | ${"[request body.wazuh.monitoring.pattern]: It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #."}
- ${'wazuh.monitoring.pattern'} | ${'test|'} | ${400} | ${"[request body.wazuh.monitoring.pattern]: It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #."}
- ${'wazuh.monitoring.pattern'} | ${'test,'} | ${400} | ${"[request body.wazuh.monitoring.pattern]: It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #."}
- ${'wazuh.monitoring.pattern'} | ${'test#'} | ${400} | ${"[request body.wazuh.monitoring.pattern]: It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #."}
- ${'wazuh.monitoring.replicas'} | ${0} | ${200} | ${null}
- ${'wazuh.monitoring.replicas'} | ${-1} | ${400} | ${"[request body.wazuh.monitoring.replicas]: Value should be greater or equal than 0."}
- ${'wazuh.monitoring.replicas'} | ${1.2} | ${400} | ${"[request body.wazuh.monitoring.replicas]: Number should be an integer."}
- ${'wazuh.monitoring.replicas'} | ${'custom'} | ${400} | ${"[request body.wazuh.monitoring.replicas]: expected value of type [number] but got [string]"}
- ${'wazuh.monitoring.shards'} | ${1} | ${200} | ${null}
- ${'wazuh.monitoring.shards'} | ${-1} | ${400} | ${"[request body.wazuh.monitoring.shards]: Value should be greater or equal than 1."}
- ${'wazuh.monitoring.shards'} | ${1.2} | ${400} | ${"[request body.wazuh.monitoring.shards]: Number should be an integer."}
- ${'wazuh.monitoring.shards'} | ${'custom'} | ${400} | ${"[request body.wazuh.monitoring.shards]: expected value of type [number] but got [string]"}
+ setting | value | responseStatusCode | responseBodyMessage
+ ${'alerts.sample.prefix'} | ${'test'} | ${200} | ${null}
+ ${'alerts.sample.prefix'} | ${''} | ${400} | ${"[request body.alerts.sample.prefix]: Value can not be empty."}
+ ${'alerts.sample.prefix'} | ${'test space'} | ${400} | ${"[request body.alerts.sample.prefix]: No whitespaces allowed."}
+ ${'alerts.sample.prefix'} | ${4} | ${400} | ${'[request body.alerts.sample.prefix]: expected value of type [string] but got [number]'}
+ ${'alerts.sample.prefix'} | ${'-test'} | ${400} | ${"[request body.alerts.sample.prefix]: It can't start with: -, _, +, .."}
+ ${'alerts.sample.prefix'} | ${'_test'} | ${400} | ${"[request body.alerts.sample.prefix]: It can't start with: -, _, +, .."}
+ ${'alerts.sample.prefix'} | ${'+test'} | ${400} | ${"[request body.alerts.sample.prefix]: It can't start with: -, _, +, .."}
+ ${'alerts.sample.prefix'} | ${'.test'} | ${400} | ${"[request body.alerts.sample.prefix]: It can't start with: -, _, +, .."}
+ ${'alerts.sample.prefix'} | ${'test\\'} | ${400} | ${"[request body.alerts.sample.prefix]: It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
+ ${'alerts.sample.prefix'} | ${'test/'} | ${400} | ${"[request body.alerts.sample.prefix]: It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
+ ${'alerts.sample.prefix'} | ${'test?'} | ${400} | ${"[request body.alerts.sample.prefix]: It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
+ ${'alerts.sample.prefix'} | ${'test"'} | ${400} | ${"[request body.alerts.sample.prefix]: It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
+ ${'alerts.sample.prefix'} | ${'test<'} | ${400} | ${"[request body.alerts.sample.prefix]: It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
+ ${'alerts.sample.prefix'} | ${'test>'} | ${400} | ${"[request body.alerts.sample.prefix]: It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
+ ${'alerts.sample.prefix'} | ${'test|'} | ${400} | ${"[request body.alerts.sample.prefix]: It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
+ ${'alerts.sample.prefix'} | ${'test,'} | ${400} | ${"[request body.alerts.sample.prefix]: It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
+ ${'alerts.sample.prefix'} | ${'test#'} | ${400} | ${"[request body.alerts.sample.prefix]: It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
+ ${'alerts.sample.prefix'} | ${'test*'} | ${400} | ${"[request body.alerts.sample.prefix]: It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
+ ${'checks.api'} | ${true} | ${200} | ${null}
+ ${'checks.api'} | ${0} | ${400} | ${'[request body.checks.api]: expected value of type [boolean] but got [number]'}
+ ${'checks.fields'} | ${true} | ${200} | ${null}
+ ${'checks.fields'} | ${0} | ${400} | ${'[request body.checks.fields]: expected value of type [boolean] but got [number]'}
+ ${'checks.maxBuckets'} | ${true} | ${200} | ${null}
+ ${'checks.maxBuckets'} | ${0} | ${400} | ${'[request body.checks.maxBuckets]: expected value of type [boolean] but got [number]'}
+ ${'checks.pattern'} | ${true} | ${200} | ${null}
+ ${'checks.pattern'} | ${0} | ${400} | ${'[request body.checks.pattern]: expected value of type [boolean] but got [number]'}
+ ${'checks.setup'} | ${true} | ${200} | ${null}
+ ${'checks.setup'} | ${0} | ${400} | ${'[request body.checks.setup]: expected value of type [boolean] but got [number]'}
+ ${'checks.template'} | ${true} | ${200} | ${null}
+ ${'checks.template'} | ${0} | ${400} | ${'[request body.checks.template]: expected value of type [boolean] but got [number]'}
+ ${'checks.timeFilter'} | ${true} | ${200} | ${null}
+ ${'checks.timeFilter'} | ${0} | ${400} | ${'[request body.checks.timeFilter]: expected value of type [boolean] but got [number]'}
+ ${'cron.prefix'} | ${'test'} | ${200} | ${null}
+ ${'cron.prefix'} | ${'test space'} | ${400} | ${"[request body.cron.prefix]: No whitespaces allowed."}
+ ${'cron.prefix'} | ${''} | ${400} | ${"[request body.cron.prefix]: Value can not be empty."}
+ ${'cron.prefix'} | ${4} | ${400} | ${'[request body.cron.prefix]: expected value of type [string] but got [number]'}
+ ${'cron.prefix'} | ${'-test'} | ${400} | ${"[request body.cron.prefix]: It can't start with: -, _, +, .."}
+ ${'cron.prefix'} | ${'_test'} | ${400} | ${"[request body.cron.prefix]: It can't start with: -, _, +, .."}
+ ${'cron.prefix'} | ${'+test'} | ${400} | ${"[request body.cron.prefix]: It can't start with: -, _, +, .."}
+ ${'cron.prefix'} | ${'.test'} | ${400} | ${"[request body.cron.prefix]: It can't start with: -, _, +, .."}
+ ${'cron.prefix'} | ${'test\\'} | ${400} | ${"[request body.cron.prefix]: It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
+ ${'cron.prefix'} | ${'test/'} | ${400} | ${"[request body.cron.prefix]: It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
+ ${'cron.prefix'} | ${'test?'} | ${400} | ${"[request body.cron.prefix]: It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
+ ${'cron.prefix'} | ${'test"'} | ${400} | ${"[request body.cron.prefix]: It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
+ ${'cron.prefix'} | ${'test<'} | ${400} | ${"[request body.cron.prefix]: It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
+ ${'cron.prefix'} | ${'test>'} | ${400} | ${"[request body.cron.prefix]: It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
+ ${'cron.prefix'} | ${'test|'} | ${400} | ${"[request body.cron.prefix]: It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
+ ${'cron.prefix'} | ${'test,'} | ${400} | ${"[request body.cron.prefix]: It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
+ ${'cron.prefix'} | ${'test#'} | ${400} | ${"[request body.cron.prefix]: It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
+ ${'cron.prefix'} | ${'test*'} | ${400} | ${"[request body.cron.prefix]: It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
+ ${'cron.statistics.apis'} | ${['test']} | ${200} | ${null}
+ ${'cron.statistics.apis'} | ${['test ']} | ${400} | ${"[request body.cron.statistics.apis.0]: No whitespaces allowed."}
+ ${'cron.statistics.apis'} | ${['']} | ${400} | ${"[request body.cron.statistics.apis.0]: Value can not be empty."}
+ ${'cron.statistics.apis'} | ${['test', 4]} | ${400} | ${"[request body.cron.statistics.apis.1]: expected value of type [string] but got [number]"}
+ ${'cron.statistics.apis'} | ${'test space'} | ${400} | ${"[request body.cron.statistics.apis]: could not parse array value from json input"}
+ ${'cron.statistics.apis'} | ${true} | ${400} | ${"[request body.cron.statistics.apis]: expected value of type [array] but got [boolean]"}
+ ${'cron.statistics.index.creation'} | ${'h'} | ${200} | ${null}
+ ${'cron.statistics.index.creation'} | ${'d'} | ${200} | ${null}
+ ${'cron.statistics.index.creation'} | ${'w'} | ${200} | ${null}
+ ${'cron.statistics.index.creation'} | ${'m'} | ${200} | ${null}
+ ${'cron.statistics.index.creation'} | ${'test'} | ${400} | ${"[request body.cron.statistics.index.creation]: types that failed validation:\n- [request body.cron.statistics.index.creation.0]: expected value to equal [h]\n- [request body.cron.statistics.index.creation.1]: expected value to equal [d]\n- [request body.cron.statistics.index.creation.2]: expected value to equal [w]\n- [request body.cron.statistics.index.creation.3]: expected value to equal [m]"}
+ ${'cron.statistics.index.name'} | ${'test'} | ${200} | ${null}
+ ${'cron.statistics.index.name'} | ${''} | ${400} | ${"[request body.cron.statistics.index.name]: Value can not be empty."}
+ ${'cron.statistics.index.name'} | ${'test space'} | ${400} | ${"[request body.cron.statistics.index.name]: No whitespaces allowed."}
+ ${'cron.statistics.index.name'} | ${true} | ${400} | ${"[request body.cron.statistics.index.name]: expected value of type [string] but got [boolean]"}
+ ${'cron.statistics.index.name'} | ${'-test'} | ${400} | ${"[request body.cron.statistics.index.name]: It can't start with: -, _, +, .."}
+ ${'cron.statistics.index.name'} | ${'_test'} | ${400} | ${"[request body.cron.statistics.index.name]: It can't start with: -, _, +, .."}
+ ${'cron.statistics.index.name'} | ${'+test'} | ${400} | ${"[request body.cron.statistics.index.name]: It can't start with: -, _, +, .."}
+ ${'cron.statistics.index.name'} | ${'.test'} | ${400} | ${"[request body.cron.statistics.index.name]: It can't start with: -, _, +, .."}
+ ${'cron.statistics.index.name'} | ${'test\\'} | ${400} | ${"[request body.cron.statistics.index.name]: It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
+ ${'cron.statistics.index.name'} | ${'test/'} | ${400} | ${"[request body.cron.statistics.index.name]: It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
+ ${'cron.statistics.index.name'} | ${'test?'} | ${400} | ${"[request body.cron.statistics.index.name]: It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
+ ${'cron.statistics.index.name'} | ${'test"'} | ${400} | ${"[request body.cron.statistics.index.name]: It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
+ ${'cron.statistics.index.name'} | ${'test<'} | ${400} | ${"[request body.cron.statistics.index.name]: It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
+ ${'cron.statistics.index.name'} | ${'test>'} | ${400} | ${"[request body.cron.statistics.index.name]: It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
+ ${'cron.statistics.index.name'} | ${'test|'} | ${400} | ${"[request body.cron.statistics.index.name]: It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
+ ${'cron.statistics.index.name'} | ${'test,'} | ${400} | ${"[request body.cron.statistics.index.name]: It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
+ ${'cron.statistics.index.name'} | ${'test#'} | ${400} | ${"[request body.cron.statistics.index.name]: It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
+ ${'cron.statistics.index.name'} | ${'test*'} | ${400} | ${"[request body.cron.statistics.index.name]: It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #, *."}
+ ${'cron.statistics.index.replicas'} | ${0} | ${200} | ${null}
+ ${'cron.statistics.index.replicas'} | ${-1} | ${400} | ${"[request body.cron.statistics.index.replicas]: Value should be greater or equal than 0."}
+ ${'cron.statistics.index.replicas'} | ${'custom'} | ${400} | ${"[request body.cron.statistics.index.replicas]: expected value of type [number] but got [string]"}
+ ${'cron.statistics.index.replicas'} | ${1.2} | ${400} | ${"[request body.cron.statistics.index.replicas]: Number should be an integer."}
+ ${'cron.statistics.index.shards'} | ${1} | ${200} | ${null}
+ ${'cron.statistics.index.shards'} | ${-1} | ${400} | ${"[request body.cron.statistics.index.shards]: Value should be greater or equal than 1."}
+ ${'cron.statistics.index.shards'} | ${1.2} | ${400} | ${"[request body.cron.statistics.index.shards]: Number should be an integer."}
+ ${'cron.statistics.interval'} | ${'0 */5 * * * *'} | ${200} | ${null}
+ ${'cron.statistics.interval'} | ${'0 */5 * * *'} | ${200} | ${null}
+ ${'cron.statistics.interval'} | ${'custom'} | ${400} | ${"[request body.cron.statistics.interval]: Interval is not valid."}
+ ${'cron.statistics.interval'} | ${true} | ${400} | ${"[request body.cron.statistics.interval]: expected value of type [string] but got [boolean]"}
+ ${'cron.statistics.status'} | ${true} | ${200} | ${null}
+ ${'cron.statistics.status'} | ${0} | ${400} | ${'[request body.cron.statistics.status]: expected value of type [boolean] but got [number]'}
+ ${'customization.reports.footer'} | ${'Test'} | ${200} | ${null}
+ ${'customization.reports.footer'} | ${'Test\nTest'} | ${200} | ${null}
+ ${'customization.reports.footer'} | ${'Test\nTest\nTest\nTest\nTest'} | ${400} | ${"[request body.customization.reports.footer]: The string should have less or equal to 2 line/s."}
+ ${'customization.reports.footer'} | ${'Line with 30 characters \nTest'} | ${200} | ${undefined}
+ ${'customization.reports.footer'} | ${'Line with 31 characters \nTest'} | ${400} | ${"[request body.customization.reports.footer]: The maximum length of a line is 30 characters."}
+ ${'customization.reports.footer'} | ${true} | ${400} | ${'[request body.customization.reports.footer]: expected value of type [string] but got [boolean]'}
+ ${'customization.reports.header'} | ${'Test'} | ${200} | ${null}
+ ${'customization.reports.header'} | ${'Test\nTest'} | ${200} | ${null}
+ ${'customization.reports.header'} | ${'Test\nTest\nTest\nTest\nTest'} | ${400} | ${"[request body.customization.reports.header]: The string should have less or equal to 3 line/s."}
+ ${'customization.reports.header'} | ${'Line with 20 charact\nTest'} | ${200} | ${undefined}
+ ${'customization.reports.header'} | ${'Line with 23 characters\nTest'} | ${400} | ${"[request body.customization.reports.header]: The maximum length of a line is 20 characters."}
+ ${'customization.reports.header'} | ${true} | ${400} | ${'[request body.customization.reports.header]: expected value of type [string] but got [boolean]'}
+ ${'disabled_roles'} | ${['test']} | ${200} | ${null}
+ ${'disabled_roles'} | ${['']} | ${400} | ${'[request body.disabled_roles.0]: Value can not be empty.'}
+ ${'disabled_roles'} | ${['test space']} | ${400} | ${"[request body.disabled_roles.0]: No whitespaces allowed."}
+ ${'disabled_roles'} | ${['test', 4]} | ${400} | ${"[request body.disabled_roles.1]: expected value of type [string] but got [number]"}
+ ${'enrollment.dns'} | ${'test'} | ${200} | ${null}
+ ${'enrollment.dns'} | ${''} | ${200} | ${null}
+ ${'enrollment.dns'} | ${'test space'} | ${400} | ${"[request body.enrollment.dns]: No whitespaces allowed."}
+ ${'enrollment.dns'} | ${true} | ${400} | ${'[request body.enrollment.dns]: expected value of type [string] but got [boolean]'}
+ ${'enrollment.password'} | ${'test'} | ${200} | ${null}
+ ${'enrollment.password'} | ${''} | ${400} | ${"[request body.enrollment.password]: Value can not be empty."}
+ ${'enrollment.password'} | ${'test space'} | ${200} | ${null}
+ ${'enrollment.password'} | ${true} | ${400} | ${'[request body.enrollment.password]: expected value of type [string] but got [boolean]'}
+ ${'extensions.audit'} | ${true} | ${200} | ${null}
+ ${'extensions.audit'} | ${0} | ${400} | ${'[request body.extensions.audit]: expected value of type [boolean] but got [number]'}
+ ${'extensions.aws'} | ${true} | ${200} | ${null}
+ ${'extensions.aws'} | ${0} | ${400} | ${'[request body.extensions.aws]: expected value of type [boolean] but got [number]'}
+ ${'extensions.ciscat'} | ${true} | ${200} | ${null}
+ ${'extensions.ciscat'} | ${0} | ${400} | ${'[request body.extensions.ciscat]: expected value of type [boolean] but got [number]'}
+ ${'extensions.gcp'} | ${true} | ${200} | ${null}
+ ${'extensions.gcp'} | ${0} | ${400} | ${'[request body.extensions.gcp]: expected value of type [boolean] but got [number]'}
+ ${'extensions.gdpr'} | ${true} | ${200} | ${null}
+ ${'extensions.gdpr'} | ${0} | ${400} | ${'[request body.extensions.gdpr]: expected value of type [boolean] but got [number]'}
+ ${'extensions.hipaa'} | ${true} | ${200} | ${null}
+ ${'extensions.hipaa'} | ${0} | ${400} | ${'[request body.extensions.hipaa]: expected value of type [boolean] but got [number]'}
+ ${'extensions.nist'} | ${true} | ${200} | ${null}
+ ${'extensions.nist'} | ${0} | ${400} | ${'[request body.extensions.nist]: expected value of type [boolean] but got [number]'}
+ ${'extensions.oscap'} | ${true} | ${200} | ${null}
+ ${'extensions.oscap'} | ${0} | ${400} | ${'[request body.extensions.oscap]: expected value of type [boolean] but got [number]'}
+ ${'extensions.osquery'} | ${true} | ${200} | ${null}
+ ${'extensions.osquery'} | ${0} | ${400} | ${'[request body.extensions.osquery]: expected value of type [boolean] but got [number]'}
+ ${'extensions.pci'} | ${true} | ${200} | ${null}
+ ${'extensions.pci'} | ${0} | ${400} | ${'[request body.extensions.pci]: expected value of type [boolean] but got [number]'}
+ ${'extensions.tsc'} | ${true} | ${200} | ${null}
+ ${'extensions.tsc'} | ${0} | ${400} | ${'[request body.extensions.tsc]: expected value of type [boolean] but got [number]'}
+ ${'extensions.virustotal'} | ${true} | ${200} | ${null}
+ ${'extensions.virustotal'} | ${0} | ${400} | ${'[request body.extensions.virustotal]: expected value of type [boolean] but got [number]'}
+ ${'ip.ignore'} | ${['test']} | ${200} | ${null}
+ ${'ip.ignore'} | ${['test*']} | ${200} | ${null}
+ ${'ip.ignore'} | ${['']} | ${400} | ${'[request body.ip.ignore.0]: Value can not be empty.'}
+ ${'ip.ignore'} | ${['test space']} | ${400} | ${"[request body.ip.ignore.0]: No whitespaces allowed."}
+ ${'ip.ignore'} | ${true} | ${400} | ${"[request body.ip.ignore]: expected value of type [array] but got [boolean]"}
+ ${'ip.ignore'} | ${['-test']} | ${400} | ${"[request body.ip.ignore.0]: It can't start with: -, _, +, .."}
+ ${'ip.ignore'} | ${['_test']} | ${400} | ${"[request body.ip.ignore.0]: It can't start with: -, _, +, .."}
+ ${'ip.ignore'} | ${['+test']} | ${400} | ${"[request body.ip.ignore.0]: It can't start with: -, _, +, .."}
+ ${'ip.ignore'} | ${['.test']} | ${400} | ${"[request body.ip.ignore.0]: It can't start with: -, _, +, .."}
+ ${'ip.ignore'} | ${['test\\']} | ${400} | ${"[request body.ip.ignore.0]: It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #."}
+ ${'ip.ignore'} | ${['test/']} | ${400} | ${"[request body.ip.ignore.0]: It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #."}
+ ${'ip.ignore'} | ${['test?']} | ${400} | ${"[request body.ip.ignore.0]: It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #."}
+ ${'ip.ignore'} | ${['test"']} | ${400} | ${"[request body.ip.ignore.0]: It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #."}
+ ${'ip.ignore'} | ${['test<']} | ${400} | ${"[request body.ip.ignore.0]: It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #."}
+ ${'ip.ignore'} | ${['test>']} | ${400} | ${"[request body.ip.ignore.0]: It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #."}
+ ${'ip.ignore'} | ${['test|']} | ${400} | ${"[request body.ip.ignore.0]: It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #."}
+ ${'ip.ignore'} | ${['test,']} | ${400} | ${"[request body.ip.ignore.0]: It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #."}
+ ${'ip.ignore'} | ${['test#']} | ${400} | ${"[request body.ip.ignore.0]: It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #."}
+ ${'ip.ignore'} | ${['test', 'test#']} | ${400} | ${"[request body.ip.ignore.1]: It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #."}
+ ${'ip.selector'} | ${true} | ${200} | ${null}
+ ${'ip.selector'} | ${''} | ${400} | ${'[request body.ip.selector]: expected value of type [boolean] but got [string]'}
+ ${'logs.level'} | ${'info'} | ${200} | ${null}
+ ${'logs.level'} | ${'debug'} | ${200} | ${null}
+ ${'logs.level'} | ${''} | ${400} | ${'[request body.logs.level]: types that failed validation:\n- [request body.logs.level.0]: expected value to equal [info]\n- [request body.logs.level.1]: expected value to equal [debug]'}
+ ${'pattern'} | ${'test'} | ${200} | ${null}
+ ${'pattern'} | ${'test*'} | ${200} | ${null}
+ ${'pattern'} | ${''} | ${400} | ${'[request body.pattern]: Value can not be empty.'}
+ ${'pattern'} | ${'test space'} | ${400} | ${"[request body.pattern]: No whitespaces allowed."}
+ ${'pattern'} | ${true} | ${400} | ${'[request body.pattern]: expected value of type [string] but got [boolean]'}
+ ${'pattern'} | ${'-test'} | ${400} | ${"[request body.pattern]: It can't start with: -, _, +, .."}
+ ${'pattern'} | ${'_test'} | ${400} | ${"[request body.pattern]: It can't start with: -, _, +, .."}
+ ${'pattern'} | ${'+test'} | ${400} | ${"[request body.pattern]: It can't start with: -, _, +, .."}
+ ${'pattern'} | ${'.test'} | ${400} | ${"[request body.pattern]: It can't start with: -, _, +, .."}
+ ${'pattern'} | ${'test\\'} | ${400} | ${"[request body.pattern]: It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #."}
+ ${'pattern'} | ${'test/'} | ${400} | ${"[request body.pattern]: It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #."}
+ ${'pattern'} | ${'test?'} | ${400} | ${"[request body.pattern]: It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #."}
+ ${'pattern'} | ${'test"'} | ${400} | ${"[request body.pattern]: It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #."}
+ ${'pattern'} | ${'test<'} | ${400} | ${"[request body.pattern]: It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #."}
+ ${'pattern'} | ${'test>'} | ${400} | ${"[request body.pattern]: It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #."}
+ ${'pattern'} | ${'test|'} | ${400} | ${"[request body.pattern]: It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #."}
+ ${'pattern'} | ${'test,'} | ${400} | ${"[request body.pattern]: It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #."}
+ ${'pattern'} | ${'test#'} | ${400} | ${"[request body.pattern]: It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #."}
+ ${'timeout'} | ${15000} | ${200} | ${null}
+ ${'timeout'} | ${1000} | ${400} | ${'[request body.timeout]: Value should be greater or equal than 1500.'}
+ ${'timeout'} | ${''} | ${400} | ${'[request body.timeout]: expected value of type [number] but got [string]'}
+ ${'timeout'} | ${1.2} | ${400} | ${"[request body.timeout]: Number should be an integer."}
+ ${'wazuh.monitoring.creation'} | ${'h'} | ${200} | ${null}
+ ${'wazuh.monitoring.creation'} | ${'d'} | ${200} | ${null}
+ ${'wazuh.monitoring.creation'} | ${'w'} | ${200} | ${null}
+ ${'wazuh.monitoring.creation'} | ${'m'} | ${200} | ${null}
+ ${'wazuh.monitoring.creation'} | ${'test'} | ${400} | ${"[request body.wazuh.monitoring.creation]: types that failed validation:\n- [request body.wazuh.monitoring.creation.0]: expected value to equal [h]\n- [request body.wazuh.monitoring.creation.1]: expected value to equal [d]\n- [request body.wazuh.monitoring.creation.2]: expected value to equal [w]\n- [request body.wazuh.monitoring.creation.3]: expected value to equal [m]"}
+ ${'wazuh.monitoring.enabled'} | ${true} | ${200} | ${null}
+ ${'wazuh.monitoring.enabled'} | ${0} | ${400} | ${'[request body.wazuh.monitoring.enabled]: expected value of type [boolean] but got [number]'}
+ ${'wazuh.monitoring.frequency'} | ${100} | ${200} | ${null}
+ ${'wazuh.monitoring.frequency'} | ${40} | ${400} | ${"[request body.wazuh.monitoring.frequency]: Value should be greater or equal than 60."}
+ ${'wazuh.monitoring.frequency'} | ${1.2} | ${400} | ${"[request body.wazuh.monitoring.frequency]: Number should be an integer."}
+ ${'wazuh.monitoring.frequency'} | ${''} | ${400} | ${'[request body.wazuh.monitoring.frequency]: expected value of type [number] but got [string]'}
+ ${'wazuh.monitoring.pattern'} | ${'test'} | ${200} | ${null}
+ ${'wazuh.monitoring.pattern'} | ${'test*'} | ${200} | ${null}
+ ${'wazuh.monitoring.pattern'} | ${''} | ${400} | ${'[request body.wazuh.monitoring.pattern]: value has length [0] but it must have a minimum length of [1].'}
+ ${'wazuh.monitoring.pattern'} | ${true} | ${400} | ${'[request body.wazuh.monitoring.pattern]: expected value of type [string] but got [boolean]'}
+ ${'wazuh.monitoring.pattern'} | ${'-test'} | ${400} | ${"[request body.wazuh.monitoring.pattern]: It can't start with: -, _, +, .."}
+ ${'wazuh.monitoring.pattern'} | ${'_test'} | ${400} | ${"[request body.wazuh.monitoring.pattern]: It can't start with: -, _, +, .."}
+ ${'wazuh.monitoring.pattern'} | ${'+test'} | ${400} | ${"[request body.wazuh.monitoring.pattern]: It can't start with: -, _, +, .."}
+ ${'wazuh.monitoring.pattern'} | ${'.test'} | ${400} | ${"[request body.wazuh.monitoring.pattern]: It can't start with: -, _, +, .."}
+ ${'wazuh.monitoring.pattern'} | ${'test\\'} | ${400} | ${"[request body.wazuh.monitoring.pattern]: It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #."}
+ ${'wazuh.monitoring.pattern'} | ${'test/'} | ${400} | ${"[request body.wazuh.monitoring.pattern]: It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #."}
+ ${'wazuh.monitoring.pattern'} | ${'test?'} | ${400} | ${"[request body.wazuh.monitoring.pattern]: It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #."}
+ ${'wazuh.monitoring.pattern'} | ${'test"'} | ${400} | ${"[request body.wazuh.monitoring.pattern]: It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #."}
+ ${'wazuh.monitoring.pattern'} | ${'test<'} | ${400} | ${"[request body.wazuh.monitoring.pattern]: It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #."}
+ ${'wazuh.monitoring.pattern'} | ${'test>'} | ${400} | ${"[request body.wazuh.monitoring.pattern]: It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #."}
+ ${'wazuh.monitoring.pattern'} | ${'test|'} | ${400} | ${"[request body.wazuh.monitoring.pattern]: It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #."}
+ ${'wazuh.monitoring.pattern'} | ${'test,'} | ${400} | ${"[request body.wazuh.monitoring.pattern]: It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #."}
+ ${'wazuh.monitoring.pattern'} | ${'test#'} | ${400} | ${"[request body.wazuh.monitoring.pattern]: It can't contain invalid characters: \\, /, ?, \", <, >, |, ,, #."}
+ ${'wazuh.monitoring.replicas'} | ${0} | ${200} | ${null}
+ ${'wazuh.monitoring.replicas'} | ${-1} | ${400} | ${"[request body.wazuh.monitoring.replicas]: Value should be greater or equal than 0."}
+ ${'wazuh.monitoring.replicas'} | ${1.2} | ${400} | ${"[request body.wazuh.monitoring.replicas]: Number should be an integer."}
+ ${'wazuh.monitoring.replicas'} | ${'custom'} | ${400} | ${"[request body.wazuh.monitoring.replicas]: expected value of type [number] but got [string]"}
+ ${'wazuh.monitoring.shards'} | ${1} | ${200} | ${null}
+ ${'wazuh.monitoring.shards'} | ${-1} | ${400} | ${"[request body.wazuh.monitoring.shards]: Value should be greater or equal than 1."}
+ ${'wazuh.monitoring.shards'} | ${1.2} | ${400} | ${"[request body.wazuh.monitoring.shards]: Number should be an integer."}
+ ${'wazuh.monitoring.shards'} | ${'custom'} | ${400} | ${"[request body.wazuh.monitoring.shards]: expected value of type [number] but got [string]"}
`(`$setting: $value - PUT /utils/configuration - $responseStatusCode`, async ({ responseBodyMessage, responseStatusCode, setting, value }) => {
const body = { [setting]: value };
const response = await supertest(innerServer.listener)