DataDog / guarddog

:snake: :mag: GuardDog is a CLI tool to Identify malicious PyPI and npm packages
https://securitylabs.datadoghq.com/articles/guarddog-identify-malicious-pypi-packages/
Apache License 2.0
629 stars 44 forks source link

Change logging stream to stderr. #440

Closed scovetta closed 4 days ago

scovetta commented 3 months ago

Logging was set to go to stdout, same as output, which breaks json output.

This change has the logging go to stderr instead.

This should fix #186.

christophetd commented 3 months ago

Thanks for the contribution! Makes sense, but it doesn't seem that your implementation is working? I would expect from your change that messaging/human-readable output goes to stderr while stdout is reserved for machine-readable output, but a standard run shows that human-readable output is going to stdout:

$ git branch scovetta/stderr-output
$ python -m guarddog pypi scan requests >stdout 2>stderr
$ cat stderr
$ cat stdout
Found 0 potentially malicious indicators scanning requests

Some rules failed to run while scanning requests:

* repository_integrity_mismatch: failed to run rule repository_integrity_mismatch: Error while cloning repository authentication required but no callback set with github url https://github.com/psf/requests
scovetta commented 3 months ago

Ack, sorry, I think I was super tired when I submitted the PR. Let me go back and make sure things look happy and I'll fix the PR. Appreciate the check on your end!

christophetd commented 3 months ago

Amazing, really appreciate the contribution!

sobregosodd commented 4 days ago

This PR is solved by https://github.com/DataDog/guarddog/pull/492