Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

alertFilters: Add param descriptions for ZAP API #6281

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion addOns/alertFilters/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ All notable changes to this add-on will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## Unreleased

### Added
- Added parameter descriptions for the ZAP API.

## [23] - 2025-01-09
### Changed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,16 +91,10 @@ public AlertFilterAPI(ExtensionAlertFilters extension) {
super();
this.extension = extension;

ApiView alertFilterList =
new ApiView(VIEW_ALERT_FILTER_LIST, new String[] {PARAM_CONTEXT_ID});
alertFilterList.setDescriptionTag("alertFilters.api.view.alertFilterList");
this.addApiView(alertFilterList);
this.addApiView(new ApiView(VIEW_ALERT_FILTER_LIST, new String[] {PARAM_CONTEXT_ID}));
this.addApiView(new ApiView(VIEW_GLOBAL_ALERT_FILTER_LIST));

ApiView globalAlertFilterList = new ApiView(VIEW_GLOBAL_ALERT_FILTER_LIST);
globalAlertFilterList.setDescriptionTag("alertFilters.api.view.globalAlertFilterList");
this.addApiView(globalAlertFilterList);

ApiAction addAlertFilter =
this.addApiAction(
new ApiAction(
ACTION_ADD_ALERT_FILTER,
new String[] {PARAM_CONTEXT_ID, PARAM_RULE_ID, PARAM_NEW_LEVEL},
Expand All @@ -115,11 +109,8 @@ public AlertFilterAPI(ExtensionAlertFilters extension) {
PARAM_EVIDENCE,
PARAM_EVIDENCE_IS_REGEX,
PARAM_METHODS,
});
addAlertFilter.setDescriptionTag("alertFilters.api.action.addAlertFilter");
this.addApiAction(addAlertFilter);

ApiAction removeAlertFilter =
}));
this.addApiAction(
new ApiAction(
ACTION_REMOVE_ALERT_FILTER,
new String[] {PARAM_CONTEXT_ID, PARAM_RULE_ID, PARAM_NEW_LEVEL},
Expand All @@ -134,11 +125,8 @@ public AlertFilterAPI(ExtensionAlertFilters extension) {
PARAM_EVIDENCE,
PARAM_EVIDENCE_IS_REGEX,
PARAM_METHODS,
});
removeAlertFilter.setDescriptionTag("alertFilters.api.action.removeAlertFilter");
this.addApiAction(removeAlertFilter);

ApiAction addGlobalAlertFilter =
}));
this.addApiAction(
new ApiAction(
ACTION_ADD_GLOBAL_ALERT_FILTER,
new String[] {PARAM_RULE_ID, PARAM_NEW_LEVEL},
Expand All @@ -153,11 +141,8 @@ public AlertFilterAPI(ExtensionAlertFilters extension) {
PARAM_EVIDENCE,
PARAM_EVIDENCE_IS_REGEX,
PARAM_METHODS,
});
addGlobalAlertFilter.setDescriptionTag("alertFilters.api.action.addGlobalAlertFilter");
this.addApiAction(addGlobalAlertFilter);

ApiAction removeGlobalAlertFilter =
}));
this.addApiAction(
new ApiAction(
ACTION_REMOVE_GLOBAL_ALERT_FILTER,
new String[] {PARAM_RULE_ID, PARAM_NEW_LEVEL},
Expand All @@ -172,41 +157,25 @@ public AlertFilterAPI(ExtensionAlertFilters extension) {
PARAM_EVIDENCE,
PARAM_EVIDENCE_IS_REGEX,
PARAM_METHODS,
});
removeGlobalAlertFilter.setDescriptionTag(
"alertFilters.api.action.removeGlobalAlertFilter");
this.addApiAction(removeGlobalAlertFilter);

ApiAction applyAll = new ApiAction(ACTION_APPLY_ALL);
applyAll.setDescriptionTag("alertFilters.api.action.applyAll");
this.addApiAction(applyAll);

ApiAction applyContext = new ApiAction(ACTION_APPLY_CONTEXT);
applyContext.setDescriptionTag("alertFilters.api.action.applyContext");
this.addApiAction(applyContext);

ApiAction applyGlobal = new ApiAction(ACTION_APPLY_GLOBAL);
applyGlobal.setDescriptionTag("alertFilters.api.action.applyGlobal");
this.addApiAction(applyGlobal);

ApiAction testAll = new ApiAction(ACTION_TEST_ALL);
testAll.setDescriptionTag("alertFilters.api.action.testAll");
this.addApiAction(testAll);

ApiAction testContext = new ApiAction(ACTION_TEST_CONTEXT);
testContext.setDescriptionTag("alertFilters.api.action.testContext");
this.addApiAction(testContext);

ApiAction testGlobal = new ApiAction(ACTION_TEST_GLOBAL);
testGlobal.setDescriptionTag("alertFilters.api.action.testGlobal");
this.addApiAction(testGlobal);
}));
this.addApiAction(new ApiAction(ACTION_APPLY_ALL));
this.addApiAction(new ApiAction(ACTION_APPLY_CONTEXT));
this.addApiAction(new ApiAction(ACTION_APPLY_GLOBAL));
this.addApiAction(new ApiAction(ACTION_TEST_ALL));
this.addApiAction(new ApiAction(ACTION_TEST_CONTEXT));
this.addApiAction(new ApiAction(ACTION_TEST_GLOBAL));
}

@Override
public String getPrefix() {
return PREFIX;
}

@Override
protected String getI18nPrefix() {
return ExtensionAlertFilters.PREFIX;
}

@Override
public ApiResponse handleApiView(String name, JSONObject params) throws ApiException {
LOGGER.debug("handleApiView {} {}", name, params);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,68 @@
alertFilters.api.action.addAlertFilter = Adds a new alert filter for the context with the given ID.
alertFilters.api.action.addGlobalAlertFilter = Adds a new global alert filter.
alertFilters.api.action.addAlertFilter = Adds a new alert filter for the context with the given ID.
alertFilters.api.action.addAlertFilter.param.attack = The attack value for which the filter should apply (can be regex).
alertFilters.api.action.addAlertFilter.param.attackIsRegex = A boolean indicating whether or not the attack value is a regex.
alertFilters.api.action.addAlertFilter.param.contextId = The numeric ID of the context for which the filter should be added.
alertFilters.api.action.addAlertFilter.param.enabled = A boolean indicating whether or not the filter should be enabled.
alertFilters.api.action.addAlertFilter.param.evidence = The evidence value for which the filter should apply (can be regex).
alertFilters.api.action.addAlertFilter.param.evidenceIsRegex = A boolean indicating whether or not the evidence value is a regex.
alertFilters.api.action.addAlertFilter.param.methods = The HTTP methods (comma separated) for which the filter should apply.
alertFilters.api.action.addAlertFilter.param.newLevel = The numeric risk representation ('0 - Informational' through '3 - High') ['-1 - False Positive'].
alertFilters.api.action.addAlertFilter.param.parameter = The parameter name for which the filter should apply (can be regex).
alertFilters.api.action.addAlertFilter.param.parameterIsRegex = A boolean indicating whether or not the parameter name is a regex.
alertFilters.api.action.addAlertFilter.param.ruleId = The numeric ID of the rule for which the filter should apply.
alertFilters.api.action.addAlertFilter.param.url = The URL for which the filter should apply (can be regex).
alertFilters.api.action.addAlertFilter.param.urlIsRegex = A boolean indicating whether or not the URL is a regex.
alertFilters.api.action.addGlobalAlertFilter = Adds a new global alert filter.
alertFilters.api.action.addGlobalAlertFilter.param.attack = The attack value for which the filter should apply (can be regex).
alertFilters.api.action.addGlobalAlertFilter.param.attackIsRegex = A boolean indicating whether or not the attack value is a regex.
alertFilters.api.action.addGlobalAlertFilter.param.contextId = The numeric ID of the context for which the filter should be added.
alertFilters.api.action.addGlobalAlertFilter.param.enabled = A boolean indicating whether or not the filter should be enabled.
alertFilters.api.action.addGlobalAlertFilter.param.evidence = The evidence value for which the filter should apply (can be regex).
alertFilters.api.action.addGlobalAlertFilter.param.evidenceIsRegex = A boolean indicating whether or not the evidence value is a regex.
alertFilters.api.action.addGlobalAlertFilter.param.methods = The HTTP methods (comma separated) for which the filter should apply.
alertFilters.api.action.addGlobalAlertFilter.param.newLevel = The numeric risk representation ('0 - Informational' through '3 - High') ['-1 - False Positive'].
alertFilters.api.action.addGlobalAlertFilter.param.parameter = The parameter name for which the filter should apply (can be regex).
alertFilters.api.action.addGlobalAlertFilter.param.parameterIsRegex = A boolean indicating whether or not the parameter name is a regex.
alertFilters.api.action.addGlobalAlertFilter.param.ruleId = The numeric ID of the rule for which the filter should apply.
alertFilters.api.action.addGlobalAlertFilter.param.url = The URL for which the filter should apply (can be regex).
alertFilters.api.action.addGlobalAlertFilter.param.urlIsRegex = A boolean indicating whether or not the URL is a regex.
alertFilters.api.action.applyAll = Applies all currently enabled Global and Context alert filters.
alertFilters.api.action.applyContext = Applies all currently enabled Context alert filters.
alertFilters.api.action.applyGlobal = Applies all currently enabled Global alert filters.
alertFilters.api.action.removeAlertFilter = Removes an alert filter from the context with the given ID.
alertFilters.api.action.removeAlertFilter.param.attack = The attack value for which the filter applies (can be regex).
alertFilters.api.action.removeAlertFilter.param.attackIsRegex = A boolean indicating whether or not the attack value is a regex.
alertFilters.api.action.removeAlertFilter.param.contextId = The numeric ID of the context for which the filter should be removed.
alertFilters.api.action.removeAlertFilter.param.enabled = A boolean indicating whether or not the filter should be enabled.
alertFilters.api.action.removeAlertFilter.param.evidence = The evidence value for which the filter applies (can be regex).
alertFilters.api.action.removeAlertFilter.param.evidenceIsRegex = A boolean indicating whether or not the evidence value is a regex.
alertFilters.api.action.removeAlertFilter.param.methods = The HTTP methods (comma separated) for which the filter applies.
alertFilters.api.action.removeAlertFilter.param.newLevel = The numeric risk representation ('0 - Informational' through '3 - High') ['-1 - False Positive'].
alertFilters.api.action.removeAlertFilter.param.parameter = The parameter name for which the filter should apply (can be regex).
alertFilters.api.action.removeAlertFilter.param.parameterIsRegex = A boolean indicating whether or not the parameter name is a regex.
alertFilters.api.action.removeAlertFilter.param.ruleId = The numeric ID of the rule for which the filter applies.
alertFilters.api.action.removeAlertFilter.param.url = The URL for which the filter applies (can be regex).
alertFilters.api.action.removeAlertFilter.param.urlIsRegex = A boolean indicating whether or not the URL is a regex.
alertFilters.api.action.removeGlobalAlertFilter = Removes a global alert filter.
alertFilters.api.action.removeGlobalAlertFilter.param.attack = The attack value for which the filter applies (can be regex).
alertFilters.api.action.removeGlobalAlertFilter.param.attackIsRegex = A boolean indicating whether or not the attack value is a regex.
alertFilters.api.action.removeGlobalAlertFilter.param.contextId = The numeric ID of the context for which the filter should be removed.
alertFilters.api.action.removeGlobalAlertFilter.param.enabled = A boolean indicating whether or not the filter should be enabled.
alertFilters.api.action.removeGlobalAlertFilter.param.evidence = The evidence value for which the filter applies (can be regex).
alertFilters.api.action.removeGlobalAlertFilter.param.evidenceIsRegex = A boolean indicating whether or not the evidence value is a regex.
alertFilters.api.action.removeGlobalAlertFilter.param.methods = The HTTP methods (comma separated) for which the filter applies.
alertFilters.api.action.removeGlobalAlertFilter.param.newLevel = The numeric risk representation ('0 - Informational' through '3 - High') ['-1 - False Positive'].
alertFilters.api.action.removeGlobalAlertFilter.param.parameter = The parameter name for which the filter should apply (can be regex).
alertFilters.api.action.removeGlobalAlertFilter.param.parameterIsRegex = A boolean indicating whether or not the parameter name is a regex.
alertFilters.api.action.removeGlobalAlertFilter.param.ruleId = The numeric ID of the rule for which the filter applies.
alertFilters.api.action.removeGlobalAlertFilter.param.url = The URL for which the filter applies (can be regex).
alertFilters.api.action.removeGlobalAlertFilter.param.urlIsRegex = A boolean indicating whether or not the URL is a regex.
alertFilters.api.action.testAll = Tests all currently enabled Global and Context alert filters.
alertFilters.api.action.testContext = Tests all currently enabled Context alert filters.
alertFilters.api.action.testGlobal = Tests all currently enabled Global alert filters.
alertFilters.api.desc = Facilitates the configuration and use of Alert Filters functionality.
alertFilters.api.view.alertFilterList = Lists the alert filters of the context with the given ID.
alertFilters.api.view.alertFilterList.param.contextId = The numeric ID of the context for which the filters should be listed.
alertFilters.api.view.globalAlertFilterList = Lists the global alert filters.

alertFilters.automation.desc = Alert Filters Automation Framework Integration
Expand Down
Loading