IBM / detect-secrets

An enterprise friendly way of detecting and preventing secrets in code.
Apache License 2.0
74 stars 46 forks source link

Fix inconsistencies with fail-on stats text output #63

Closed victoria-miltcheva closed 2 years ago

victoria-miltcheva commented 2 years ago

Fixes the following output:

detect-secrets audit --report --fail-on-audited-real .secrets.baseline

Before


10 potential secrets in .secrets.baseline were reviewed. Found and 1 secret that was audited as real.

Failed Condition    Secret Type    Filename                                 Line
------------------  -------------  -------------------------------------  ------
Audited as real     Private Key    detect_secrets/plugins/private_key.py      45

Failed conditions:

        - Audited true secrets were found

                Remove secrets meeting this condition from the codebase, and run detect-secrets scan --update .secrets.baseline to re-scan.

For additional help, run detect-secrets audit --help.

After


10 potential secrets in .secrets.baseline were reviewed. Found 1 secret that was audited as real.

Failed Condition    Secret Type    Filename                                 Line
------------------  -------------  -------------------------------------  ------
Audited as real     Private Key    detect_secrets/plugins/private_key.py      45

Failed conditions:

        - Audited true secrets were found

                Remove secrets meeting this condition from the codebase, and run detect-secrets scan --update .secrets.baseline to re-scan.

For additional help, run detect-secrets audit --help.

detect-secrets audit --report --fail-on-unaudited .secrets.baseline

Before


10 potential secrets in .secrets.baseline were reviewed. Found 1 unaudited secret,
Failed Condition    Secret Type    Filename                                 Line
------------------  -------------  -------------------------------------  ------
Unaudited           Private Key    detect_secrets/plugins/private_key.py      46

Failed conditions:

        - Unaudited secrets were found

                Run detect-secrets audit .secrets.baseline, and audit all potential secrets.

For additional help, run detect-secrets audit --help.

After


10 potential secrets in .secrets.baseline were reviewed. Found 1 unaudited secret.

Failed Condition    Secret Type    Filename                                 Line
------------------  -------------  -------------------------------------  ------
Unaudited           Private Key    detect_secrets/plugins/private_key.py      46

Failed conditions:

        - Unaudited secrets were found

                Run detect-secrets audit .secrets.baseline, and audit all potential secrets.

For additional help, run detect-secrets audit --help.

detect-secrets audit --report --fail-on-live .secrets.baseline

Before


10 potential secrets in .secrets.baseline were reviewed. Found 1 live secret
Failed Condition    Secret Type              Filename         Line
------------------  -----------------------  -------------  ------
Live                Hex High Entropy String  docs/audit.md      83

Failed conditions:

        - Live secrets were found

                Revoke all live secrets and remove them from the codebase. Afterwards, run detect-secrets scan --update .secrets.baseline to re-scan.

For additional help, run detect-secrets audit --help.

After


10 potential secrets in .secrets.baseline were reviewed. Found 1 live secret.

Failed Condition    Secret Type              Filename         Line
------------------  -----------------------  -------------  ------
Live                Hex High Entropy String  docs/audit.md      83

Failed conditions:

        - Live secrets were found

                Revoke all live secrets and remove them from the codebase. Afterwards, run detect-secrets scan --update .secrets.baseline to re-scan.

For additional help, run detect-secrets audit --help.

detect-secrets audit --report --fail-on-live --fail-on-unaudited .secrets.baseline

Before


10 potential secrets in .secrets.baseline were reviewed. Found 1 live secret, 1 unaudited secret,
Failed Condition    Secret Type              Filename                                 Line
------------------  -----------------------  -------------------------------------  ------
Live                Hex High Entropy String  docs/audit.md                              83
Unaudited           Private Key              detect_secrets/plugins/private_key.py      46

Failed conditions:

        - Unaudited secrets were found

                Run detect-secrets audit .secrets.baseline, and audit all potential secrets.
        - Live secrets were found

                Revoke all live secrets and remove them from the codebase. Afterwards, run detect-secrets scan --update .secrets.baseline to re-scan.

For additional help, run detect-secrets audit --help.

After


10 potential secrets in .secrets.baseline were reviewed. Found 1 live secret and 1 unaudited secret.

Failed Condition    Secret Type              Filename                                 Line
------------------  -----------------------  -------------------------------------  ------
Live                Hex High Entropy String  docs/audit.md                              83
Unaudited           Private Key              detect_secrets/plugins/private_key.py      46

Failed conditions:

        - Unaudited secrets were found

                Run detect-secrets audit .secrets.baseline, and audit all potential secrets.
        - Live secrets were found

                Revoke all live secrets and remove them from the codebase. Afterwards, run detect-secrets scan --update .secrets.baseline to re-scan.

For additional help, run detect-secrets audit --help.

detect-secrets audit --report --fail-on-unaudited --fail-on-audited-real .secrets.baseline

Before


10 potential secrets in .secrets.baseline were reviewed. Found 1 unaudited secret, and 1 secret that was audited as real.

Failed Condition    Secret Type    Filename                                 Line
------------------  -------------  -------------------------------------  ------
Unaudited           Private Key    detect_secrets/plugins/private_key.py      46
Audited as real     Private Key    detect_secrets/plugins/private_key.py      45

Failed conditions:

        - Unaudited secrets were found

                Run detect-secrets audit .secrets.baseline, and audit all potential secrets.
        - Audited true secrets were found

                Remove secrets meeting this condition from the codebase, and run detect-secrets scan --update .secrets.baseline to re-scan.

For additional help, run detect-secrets audit --help.

After


10 potential secrets in .secrets.baseline were reviewed. Found 1 unaudited secret and 1 secret that was audited as real.

Failed Condition    Secret Type    Filename                                 Line
------------------  -------------  -------------------------------------  ------
Unaudited           Private Key    detect_secrets/plugins/private_key.py      46
Audited as real     Private Key    detect_secrets/plugins/private_key.py      45

Failed conditions:

        - Unaudited secrets were found

                Run detect-secrets audit .secrets.baseline, and audit all potential secrets.
        - Audited true secrets were found

                Remove secrets meeting this condition from the codebase, and run detect-secrets scan --update .secrets.baseline to re-scan.

For additional help, run detect-secrets audit --help.

detect-secrets audit --report --fail-on-unaudited --fail-on-audited-real --fail-on-live .secrets.baseline

Before


10 potential secrets in .secrets.baseline were reviewed. Found 1 live secret, 1 unaudited secret, and 1 secret that was audited as real.

Failed Condition    Secret Type              Filename                                 Line
------------------  -----------------------  -------------------------------------  ------
Live                Hex High Entropy String  docs/audit.md                              83
Unaudited           Private Key              detect_secrets/plugins/private_key.py      46
Audited as real     Private Key              detect_secrets/plugins/private_key.py      45

Failed conditions:

        - Unaudited secrets were found

                Run detect-secrets audit .secrets.baseline, and audit all potential secrets.
        - Live secrets were found

                Revoke all live secrets and remove them from the codebase. Afterwards, run detect-secrets scan --update .secrets.baseline to re-scan.
        - Audited true secrets were found

                Remove secrets meeting this condition from the codebase, and run detect-secrets scan --update .secrets.baseline to re-scan.

For additional help, run detect-secrets audit --help.

After


10 potential secrets in .secrets.baseline were reviewed. Found 1 live secret, 1 unaudited secret and 1 secret that was audited as real.

Failed Condition    Secret Type              Filename                                 Line
------------------  -----------------------  -------------------------------------  ------
Live                Hex High Entropy String  docs/audit.md                              83
Unaudited           Private Key              detect_secrets/plugins/private_key.py      46
Audited as real     Private Key              detect_secrets/plugins/private_key.py      45

Failed conditions:

        - Unaudited secrets were found

                Run detect-secrets audit .secrets.baseline, and audit all potential secrets.
        - Live secrets were found

                Revoke all live secrets and remove them from the codebase. Afterwards, run detect-secrets scan --update .secrets.baseline to re-scan.
        - Audited true secrets were found

                Remove secrets meeting this condition from the codebase, and run detect-secrets scan --update .secrets.baseline to re-scan.

For additional help, run detect-secrets audit --help.

^ I removed the usage of the oxford comma since it was causing issues.