Skip to content

scan --wfp exits 0 even when every API request fails #220

Open

Description

@joel-nb

Version: 1.54.1 (also verified in 1.51.1)

The scan sub-command checks the scanner's return value and exits non-zero on failure for every scan mode except --wfp:

# cli.py (v1.54.1, ~line 1713)
if args.wfp:
    ...
    scanner.scan_wfp_with_options(args.wfp, args.dep)   # return value discarded
elif args.stdin:
    if not scanner.scan_contents(args.stdin, contents):
        sys.exit(1)
elif args.files:
    if not scanner.scan_files_with_options(...):
        sys.exit(1)

scan_wfp_with_options() does return False on errors, it's just never checked in this branch.

Repro:

$ scanoss-py wfp myrepo/ -o fp.wfp
$ scanoss-py scan --wfp fp.wfp --key <invalid-or-rate-limited> -o out.json
$ echo $?
0

Every request fails (stderr shows the errors), out.json is empty, exit code is 0. We hit this in production during a rate-limit event: a scheduled scan where all 12 requests were rejected with 429 reported success with an empty results file, and downstream tooling treated it as a valid scan with zero findings.

Expected: exit 1, matching the behavior of the other scan modes. Looks like a one-line fix.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions