GitGuardian / ggshield

Find and fix 360+ types of hardcoded secrets and 70+ types of infrastructure-as-code misconfigurations.
https://gitguardian.com
MIT License
1.57k stars 138 forks source link

Use allow-self-signed in auth login command #904

Closed irgeek closed 1 month ago

irgeek commented 1 month ago

Context

The ggshield auth login command isn't using the --allow-self-hosted flag.

What has been done

Passing allow_self_hosted to the create_client function--as we're already doing for auth logout.

Validation

Without the fix, trying run ggshield auth login --allow-self-signed against a GitGuardian instance using an untrusted certificate or being routed through a TLS bump proxy will result in an error:

requests.exceptions.SSLError: HTTPSConnectionPool(host='hostname.example.com', port=443): Max retries exceeded with url: /exposed/v1/token (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self-signed certificate (_ssl.c:1007)')))

With the fix the certificate error won't appear.

PR check list

agateau-gg commented 1 month ago

Looks good, thanks!