I am using the patch from #2912708.

drush security:review always returns a 0 exit code, even when some checks fail.
It should return a non-zero exit code so CI tools can detect it failed.

CommentFileSizeAuthor
#2 security_review-3155645-2.patch1.35 KBprudloff

Comments

prudloff created an issue. See original summary.

prudloff’s picture

Status: Active » Needs review
StatusFileSize
new1.35 KB

The attached patch makes the command return 1 if at least one check failed.

smustgrave’s picture

Status: Needs review » Closed (cannot reproduce)

On Drupal 9.5
Latest version of security review

Have ran drush security:review. drush security-review and not able to generate an issue.

If you are still seeing this error please reopen with an update issue summary and steps to replicate.

prudloff’s picture

Status: Closed (cannot reproduce) » Needs review

I can still reproduce with 1.0.0-alpha2.
Here is how I test:

  1. Run drush security:review --results
  2. A test fails
  3. Check the exit code (echo $?)

If tests succeed, the exit code should be 0; if a test fails, the exit code should be >0 (so the shell can now the command failed).

greggles’s picture

Title: Drush command exit code » Drush command exit code should be nonzero if a test fails

Adjusting the title to be more specific.

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

Can confirm now when running the command

drush security:review --results. I get

Failed to run drush security:review --results: exit status 1

smustgrave’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.