Skip to content

[Feat]: Support wrapping non-zero exit codes #789

Description

@adityasaky

Describe the solution you'd like:

Support specific command runs to return non zero exit codes. Add --accept-exit-codes 0,2,100,101 (or similar) to witness run so valid non-zero exits are treated as command success.

User value:

[Why will this feature be valuable to you? Why will this be valuable to others?]

Security scanners use non-zero exit codes to report findings (not errors): oscap returns 2 for "vulnerabilities found", cinc-auditor returns 100 (skipped/waived) or 101 (failures found). Witness treats any non-zero as command failure and refuses to produce a signed collection.

Expected behavior:

When run with the new flag, witness produces a collection even when the executed command returns a non zero but explicitly allowed exit code.

Proposed solution:

[If you're able, describe possible solution workflow]

Anything else you would like to add:

N/A

Testing changes required:

Create a test binary to return specific exit codes for witness run tests to invoke.

Documentation changes required:

[List possible documentation changes required, if none please explain, if unsure assignee will assist]

Document the new flag.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions