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

fix(auth_login): error handling with invalid instance URL #897

Closed salome-voltz closed 1 month ago

salome-voltz commented 1 month ago

Context

ggshield auth login flow errors were not handled when instance URL is invalid.

What has been done

Error thrown are handled, similarly to how error are handled with GITGUARDIAN_INSTANCE='https://dashboard.gitguardian.com/abc' ggshield auth login --method=token

Validation

Run the following commands:

Note

This also fixes the following issue: #892 image

PR check list

codecov-commenter commented 1 month ago

Codecov Report

Attention: Patch coverage is 66.66667% with 5 lines in your changes are missing coverage. Please review.

Project coverage is 91.81%. Comparing base (372be8a) to head (d7f1289). Report is 63 commits behind head on main.

Files Patch % Lines
ggshield/cmd/auth/login.py 42.85% 4 Missing :warning:
ggshield/core/url_utils.py 85.71% 1 Missing :warning:

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #897 +/- ## ========================================== + Coverage 91.67% 91.81% +0.13% ========================================== Files 170 171 +1 Lines 7060 7046 -14 ========================================== - Hits 6472 6469 -3 + Misses 588 577 -11 ``` | [Flag](https://app.codecov.io/gh/GitGuardian/ggshield/pull/897/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=GitGuardian) | Coverage Δ | | |---|---|---| | [unittests](https://app.codecov.io/gh/GitGuardian/ggshield/pull/897/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=GitGuardian) | `91.81% <66.66%> (+0.13%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=GitGuardian#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.