API Fuzzing override cmd output
Proposal
Currently, the job apifuzzer_fuzz from the API-Fuzzing.gitlab-ci.yml template has no clear way to enable/disable stdout and/or stderr from the script provided at FUZZAPI_OVERRIDES_CMD env variable. We have no way to know if it fails or succeeds
It will be great if this job has something like FUZZAPI_OVERRIDES_CMD_VERBOSE to enable or disable our command output to the job log.
The job output looks like this:
2021-06-24 17:56:46 [INF] API Runner: Setting up override interval to 18000 seconds
2021-06-24 17:56:46 [INF] API Runner: Process [54] Command: 'bash -c .gitlab/infra/get_access_token.py'
2021-06-24 17:56:49 [INF] API Runner: Override refreshing from file path or URI: /output/dast-api-overrides.json
2021-06-24 17:56:49 [ERR] API Runner: Override Set up has failed. Error : 'The file path: '/output/dast-api-overrides.json' does not exist.'
Peach.Web.Runner.Services.FileLoaderException: The file path: '/output/dast-api-overrides.json' does not exist.
at Peach.Web.Runner.Services.FileLoader.LoadFilePath(String inputUrlOrFilePath) in /builds/gitlab-org/security-products/analyzers/api-fuzzing-src/web/Runner/Services/FileLoader.cs:line 100
at Peach.Web.Runner.Services.FileLoader.Load(String inputUrlOrFilePath) in /builds/gitlab-org/security-products/analyzers/api-fuzzing-src/web/Runner/Services/FileLoader.cs:line 33
at Peach.Web.Runner.Services.Overrides.LoadFromFile(String inputUrlOrFilePath) in /builds/gitlab-org/security-products/analyzers/api-fuzzing-src/web/Runner/Services/Overrides.cs:line 36
at Peach.Web.Runner.Services.Overrides.ReloadOverrides() in /builds/gitlab-org/security-products/analyzers/api-fuzzing-src/web/Runner/Services/Overrides.cs:line 134
at Peach.Web.Runner.Services.Overrides.Setup(IApplicationOptions applicationOptions) in /builds/gitlab-org/security-products/analyzers/api-fuzzing-src/web/Runner/Services/Overrides.cs:line 123
at Peach.Web.Runner.Services.OperationRunner.Run(IReader reader, IApplicationOptions applicationOptions, ICommandOptions commandOptions) in /builds/gitlab-org/security-products/analyzers/api-fuzzing-src/web/Runner/Services/OperationRunner.cs:line 60
2021-06-24 17:56:50 [WAR] API Security: Automation process exitted with out calling suite teardown
2021-06-24 17:56:50 [INF] API Security: Generating security report as 'gl-api-fuzzing-report.json'.
2021-06-24 17:56:50 [INF] API Security:
2021-06-24 17:56:50 [INF] API Security: --[ Tested Operations ]-------------------------
2021-06-24 17:56:50 [INF] API Security: No operations were tested. Please check your configuration.
2021-06-24 17:56:50 [INF] API Security: ------------------------------------------------
2021-06-24 17:56:50 [INF] API Security: --[ Excluded Operations ]-----------------------
2021-06-24 17:56:50 [INF] API Security: No operations were excluded
2021-06-24 17:56:50 [INF] API Security: ------------------------------------------------
2021-06-24 17:56:50 [INF] API Security:
2021-06-24 17:56:50 [INF] API Security: Testing completed successfully, no security issues detected.
The python script print to console any error that prevents it to generate the file with the token, or if everything was okay.
Implementation
-
Add new variable FUZZAPI_OVERRIDES_CMD_VERBOSEthat defaults to off/false. When enabled, show the overrides script's console output. -
When the overrides script exits with non-zero, display the command output and log it to the debug log. -
Add unit/integration tests -
Document the new variable -
Document in API Fuzzing docs -
Document in DAST API docs
-
-
Expand the overrides documentation section with information about non-zero exit code, this variable, and also how to generate a log file that is collected by the job. - Simple python program using the python logging. Call out how to construct the correct filename
$CI_PROJECT_DIR/gl-user-override.log. In python you will need to get the CI_PROJECT_DIR through the environment interface.
- Simple python program using the python logging. Call out how to construct the correct filename
-
Publish new image
Edited by Michael Eddington