-
Notifications
You must be signed in to change notification settings - Fork 83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow to ignore validation of TLS certificates #125
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @seqre! This is looking really good.
I suspect that these changes will fix enumeration of GitHub API servers that may be behind self-signed or otherwise invalid certificates. But I don't believe the behavior of ignoring certificates is propagated into the code that actually clones repositories, which I think is the actual problem in #116.
Some background
Nosey Parker shells out to git
to do its cloning; you can see this at crates/noseyparker/src/git_binary.rs. I had earlier tried to use both libgit2
and the Rust-native gix
implementations instead, but both of those ran into problems when trying to do bare or mirror clones.
Nosey Parker's git
wrapper goes out of its way to ignore any user- or system-specific git configuration. It also uses some convoluted shell scripting to propagate any provided GitHub access token to the underlying git
binary.
Nice-to-have
It would be nice if there were a couple new integration test cases:
- One that tests that the
github repos list
command works against a server with an invalid certificate - One that tests that the
scan --git-url https://some-invalid-cert-server.example.com/foo.git
behaves as expected with and without the--ignore-certs
CLI option
I realize that these test cases may be difficult to express, as they depend on complicated external systems, so I won't require them.
To finish this PR
-
When the new
--ignore-certs
CLI option is specified, thegit
wrapper probably needs to be updated to set theGIT_SSL_NO_VERIFY=1
environment variable, probably here. -
Run a manual test that
scan --git-url https://some-invalid-cert-server.example.com/foo.git
works as intended both with and without the--ignore-certs
CLI option -
If not adding new integration tests mentioned in the "Nice-to-have" section, add a TODO comment about those scenarios here
Co-authored-by: Brad Larsen <[email protected]>
I've applied review comments and tested manually that the flag works against self-hosted Gitea with self-signed SSL certificates. Output without the
Once the Regarding the nice-to-have tests, I'd gladly create them, but I have no idea how to approach them. I don't think we want to spin up the git server in the CI pipeline or connect to some random git server on the Internet that doesn't have proper certificates. |
Yeah, I don't know an easy way to write those tests either. Don't worry about adding those now. |
Thanks @seqre! |
This PR closes #116. If there's a need for tests or anything else, I can add them.
There are two approaches I see to CLI arguments:
GlobalArgs
is not always passed that deep. Also, it wouldn't apply to all subcommands, so it wouldn't be truly "global".