[PM-5437] Handle client_credentials clientId that is not a valid GUID
Type of change
- [X] Bug fix
- [ ] New feature development
- [ ] Tech debt (refactoring, code cleanup, dependency upgrades, etc)
- [ ] Build/deploy pipeline (DevOps)
- [ ] Other
Objective
When using the client_credentials grant type, the ClientStore is used to retrieve the client information by clientId.
We were missing a check to make sure that the clientId is a valid GUID before instantiating the new GUID object. This would throw an exception and return a 500 response to users if the provided clientId could not be parsed.
Code changes
-
ClientStore.cs: Use
TryParseto make sure theclientIdis a valid GUID. Returnnullif not.
Before you submit
- Please check for formatting errors (
dotnet format --verify-no-changes) (required) - If making database changes - make sure you also update Entity Framework queries and/or migrations
- Please add unit tests where it makes sense to do so (encouraged but not required)
- If this change requires a documentation update - notify the documentation team
- If this change has particular deployment requirements - notify the DevOps team
Codecov Report
Attention: 4 lines in your changes are missing coverage. Please review.
Comparison is base (
70fac80) 36.36% compared to head (3d3fb9d) 36.36%.
| Files | Patch % | Lines |
|---|---|---|
| src/Identity/IdentityServer/ClientStore.cs | 0.00% | 4 Missing :warning: |
Additional details and impacted files
@@ Coverage Diff @@
## main #3616 +/- ##
==========================================
- Coverage 36.36% 36.36% -0.01%
==========================================
Files 1158 1158
Lines 55884 55887 +3
Branches 5376 5377 +1
==========================================
Hits 20324 20324
- Misses 34614 34617 +3
Partials 946 946
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Quality Gate passed
Issues
0 New issues
Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code
Checkmarx One – Scan Summary & Details – 807dc0c9-d6ae-4db0-bdc1-fd663f7d20d2