From da4b7fe0071bee8e73c063693b8d0d995b555d9c Mon Sep 17 00:00:00 2001 From: Ahmed Abdelsalam Date: Fri, 19 Jan 2024 14:18:55 +0100 Subject: [PATCH 1/5] Change: Add usage_type parameter to GMP get_reports. get_reports can now be used to get a report by its usage type (scan/audit). --- src/gsad_gmp.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/gsad_gmp.c b/src/gsad_gmp.c index f38f45b58..2550adf70 100644 --- a/src/gsad_gmp.c +++ b/src/gsad_gmp.c @@ -8465,12 +8465,13 @@ char * get_reports_gmp (gvm_connection_t *connection, credentials_t *credentials, params_t *params, cmd_response_data_t *response_data) { - const gchar *filter, *filter_id, *details; + const gchar *filter, *filter_id, *details, *usage_type; gmp_arguments_t *arguments; filter = params_value (params, "filter"); filter_id = params_value (params, "filter_id"); details = params_value (params, "details"); + usage_type = params_value (params, "usage_type"); arguments = gmp_arguments_new (); @@ -8498,6 +8499,10 @@ get_reports_gmp (gvm_connection_t *connection, credentials_t *credentials, { gmp_arguments_add (arguments, "details", details); } + if (usage_type) + { + gmp_arguments_add (arguments, "usage_type", usage_type); + } params_remove (params, "filter"); params_remove (params, "filter_id"); From 15398e84fa929a0129771d589c619c939189a35d Mon Sep 17 00:00:00 2001 From: Ahmed Abdelsalam Date: Fri, 2 Feb 2024 11:18:39 +0100 Subject: [PATCH 2/5] Added audit_report as a resource type --- src/gsad_validator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gsad_validator.c b/src/gsad_validator.c index 87745e475..176892541 100644 --- a/src/gsad_validator.c +++ b/src/gsad_validator.c @@ -469,7 +469,7 @@ init_validator () gvm_validator_add (validator, "port_range_id", "^[a-z0-9\\-]+$"); gvm_validator_add ( validator, "resource_type", - "^(alert|asset|cert_bund_adv|config|cpe|credential|cve|dfn_cert_adv|" + "^(alert|asset|audit_report|cert_bund_adv|config|cpe|credential|cve|dfn_cert_adv|" "filter|group|host|info|nvt|note|os|ovaldef|override|permission|port_list|" "report|report_config|report_format|result|role|scanner|schedule|tag|" "target|task|ticket|" From b819b7cd48c3e357f5daa8075012f2018570d7b0 Mon Sep 17 00:00:00 2001 From: Ahmed Abdelsalam Date: Fri, 2 Feb 2024 11:23:24 +0100 Subject: [PATCH 3/5] Fix code formatting --- src/gsad_validator.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/gsad_validator.c b/src/gsad_validator.c index 176892541..4337e75a5 100644 --- a/src/gsad_validator.c +++ b/src/gsad_validator.c @@ -469,11 +469,10 @@ init_validator () gvm_validator_add (validator, "port_range_id", "^[a-z0-9\\-]+$"); gvm_validator_add ( validator, "resource_type", - "^(alert|asset|audit_report|cert_bund_adv|config|cpe|credential|cve|dfn_cert_adv|" - "filter|group|host|info|nvt|note|os|ovaldef|override|permission|port_list|" - "report|report_config|report_format|result|role|scanner|schedule|tag|" - "target|task|ticket|" - "tls_certificate|user|vuln|)$"); + "^(alert|asset|audit_report|cert_bund_adv|config|cpe|credential|cve|" + "dfn_cert_adv|filter|group|host|info|nvt|note|os|ovaldef|override|" + "permission|port_list|report|report_config|report_format|result|role|scanner|" + "schedule|tag|target|task|ticket|tls_certificate|user|vuln|)$"); gvm_validator_add (validator, "resource_id", "^[[:alnum:]\\-_.:\\/~]*$"); gvm_validator_add (validator, "resources_action", "^(|add|set|remove)$"); gvm_validator_add ( From 30a40cdea74008d0f604a221fb3f8fd0841b2eb2 Mon Sep 17 00:00:00 2001 From: Ahmed Abdelsalam Date: Tue, 13 Feb 2024 17:10:08 +0100 Subject: [PATCH 4/5] Added audit and policy as resource types --- src/gsad_validator.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gsad_validator.c b/src/gsad_validator.c index 4337e75a5..1e4a2c012 100644 --- a/src/gsad_validator.c +++ b/src/gsad_validator.c @@ -469,9 +469,9 @@ init_validator () gvm_validator_add (validator, "port_range_id", "^[a-z0-9\\-]+$"); gvm_validator_add ( validator, "resource_type", - "^(alert|asset|audit_report|cert_bund_adv|config|cpe|credential|cve|" + "^(alert|asset|audit_report|audit|cert_bund_adv|config|cpe|credential|cve|" "dfn_cert_adv|filter|group|host|info|nvt|note|os|ovaldef|override|" - "permission|port_list|report|report_config|report_format|result|role|scanner|" + "permission|policy|port_list|report|report_config|report_format|result|role|scanner|" "schedule|tag|target|task|ticket|tls_certificate|user|vuln|)$"); gvm_validator_add (validator, "resource_id", "^[[:alnum:]\\-_.:\\/~]*$"); gvm_validator_add (validator, "resources_action", "^(|add|set|remove)$"); From 5e2f82d32f6b803c5f75407050ed9e33e3211f1a Mon Sep 17 00:00:00 2001 From: Ahmed Abdelsalam Date: Tue, 11 Jun 2024 14:26:46 +0200 Subject: [PATCH 5/5] Fix linting error after resolving conflicts. --- src/gsad_validator.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gsad_validator.c b/src/gsad_validator.c index 1e4a2c012..462be24f3 100644 --- a/src/gsad_validator.c +++ b/src/gsad_validator.c @@ -471,7 +471,8 @@ init_validator () validator, "resource_type", "^(alert|asset|audit_report|audit|cert_bund_adv|config|cpe|credential|cve|" "dfn_cert_adv|filter|group|host|info|nvt|note|os|ovaldef|override|" - "permission|policy|port_list|report|report_config|report_format|result|role|scanner|" + "permission|policy|port_list|report|report_config|report_format|result|" + "role|scanner|" "schedule|tag|target|task|ticket|tls_certificate|user|vuln|)$"); gvm_validator_add (validator, "resource_id", "^[[:alnum:]\\-_.:\\/~]*$"); gvm_validator_add (validator, "resources_action", "^(|add|set|remove)$");