question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Automation plan with failOnWarning: true still ends with exit code 0 if scan produces warnings

See original GitHub issue

Describe the bug I expected the automation framework parameter failOnWarning with value true to cause the execution of a plan containing it to fail, if the scan results in any warnings. That does not seem to be the case. Upon running the plan below against a target that produces warnings, the exit code remains 0. Please excuse me, if I misunderstood the meaning of failOnWarning in the first place!

To Reproduce Run the following plan against a target that produces warnings:

env:
  contexts:
  - excludePaths: []
    name: baseline
    urls:
    - http://ci-demo-master
  parameters:
    failOnError: true
    failOnWarning: true
    progressToStdout: false
jobs:
- install:
  - pscanrulesBeta
  type: addOns
  uninstall: []
- parameters:
    enableTags: false
    maxAlertsPerRule: 10
  type: passiveScan-config
- parameters:
    maxDuration: 1
    url: http://ci-demo-master
  type: spider
- parameters:
    maxDuration: 0
  type: passiveScan-wait
- parameters:
    format: Long
    summaryFile: /tmp/zap_out.json
  rules: []
  type: outputSummary
- type: report
  parameters:
    reportDir: /tmp/testing/artifacts
    template: traditional-html
- type: report
  parameters:
    reportDir: /tmp/testing/artifacts
    template: traditional-json

Expected behavior The execution of the automation plan ends with an exit code != 0

Screenshots

Software versions

  • ZAP: 2.11.0
  • Add-on: None except the defaults and the ones required by the plan above
  • OS: Official zap2docker-stable container
  • Java: 11.0.11 according to ZAP output (Found Java version 11.0.11)
  • Browser: -

Errors from the zap.log file No errors, only INFO output in zap.log

Additional context

Would you like to help fix this issue? Gladly 👍

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:16 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
psiinoncommented, Nov 16, 2021

Yeah, I get this too 😦 Will investigate further…

0reactions
va1entincommented, Nov 18, 2021

Thanks a lot! Since there’s an easy workaround with the summaryFile this is probably not the highest priority so no worries 😃

A little follow-up: The zap2docker image doesn’t contain jq so here is a one-liner to achieve the same as outlined above without jq.

warn=$(grep warn zap_out.json | grep -Eo '[0-9]*')
Read more comments on GitHub >

github_iconTop Results From Across the Web

Warnings result in a non-0 exit code · Issue #652 - GitHub
Warnings result in a successful (0) exit code, unless otherwise specified with --fail-on-warning in passthru options.
Read more >
userguide.pdf - Gradle User Manual
Runs the tasks selected at the end of the configuration phase. ... Executing a Gradle build without a settings file is now an...
Read more >
Troubleshooting CI/CD - GitLab Docs
If a pipeline does not seem to run at all, with no error message, it may also be due to rules or only/except...
Read more >
PVS-Studio Documentation (single page)
The plugin allows you to handle analyzer reports: view warnings, filter them, etc. You can't run code analysis yet — we plan to...
Read more >
The definitive guide to install4j - ej-technologies
The actual installation of these files is handled by the "Install files" action which ... Within a single file set, it causes an...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found