Allow the user to exclude a parameter for API Fuzzing
Problem
A user wants to exclude a parameter from testing. Parameter could be any supported (header, path, querystring, etc.). This can happen when a field always causes an API failure, or a finding that will not be fixed.
Proposal
Add the following two variables:
DAST_API_EXCLUDE_PARAMETER_ENV={json}User can provide the json as a stringDAST_API_EXCLUDE_PARAMETER_FILE=exlude_parameters.jsonUser can provide the json as url/file- Error if both are set
Use a json format similar to overrides to allow users to define parameters to skip during testing:
{
"headers": [
"header1",
"header2"
],
"cookies": [
"cookie1",
"cookie2"
],
"query": [
"query-string1",
"query-string2"
],
"body-form": [
"form-param1",
"form-param2"
],
"body-json": [
"json-path1",
"json-path2"
],
"body-xml" : [
"xpath1",
"xpath2"
]
}Add a section to the worker-entry output to list excluded parameters.
Tasks
- Worker-Entry
- Add new variables (
_EXCLUDE_PARAMETER_ENVand_EXCLUDE_PARAMETER_FILE) - Error when the two are variables are set at the same time
- If a file is given, then check it can be loaded and it JSON. If not throw proper error (file can use BasePath)
- If the content is given, check JSON can be loaded. If not then throw proper error
- Use RunnerOptions to pass over the scanner the exclude parameter config.
- Add a new section in the worker-entry final report. Listing the excluded parameters
- Add new variables (
- Scanner/Runner
- Load exclude parameter config. If a file path is used, then it can use BasePath settings to locate the file.
- Exclude parameters TDB
- Tests
- Add integration test in worker-entry to check error when the two variables are set
- Add integration test in worker-entry to check when file does not exist or cannot be downloaded
- Add integration test in worker-entry to check when the file content is not a valid JSON
- Add integration test in worker-entry excluding each type of parameter.
- Matching (for XML take into account custom namespaces)
- Non-Matching
- Invalid expression (e.g. incorrect JSON-Path or XPath expressions)
- Update documentation
- Add new variables
- Provide explanation of expected use case
- Provide example
Links
- [internal] Dogfooding conversation https://gitlab.slack.com/archives/CUTDH1V8R/p1607348957372100
Edited by Herber Madrigal