go-jwt-middleware
go-jwt-middleware copied to clipboard
Fix panic threat when using type-cast
Description
The threat of panicking should be curbed by receiving a second return value when executing the type-cast.
References
- CodeReviewComments: https://github.com/golang/go/wiki/CodeReviewComments#dont-panic
- Effective Go: https://go.dev/doc/effective_go#interface_conversions
Testing
- [x] This change adds test coverage for new/changed/fixed functionality
Checklist
- [x] I have read and agreed to the terms within the Auth0 Code of Conduct.
- [x] I have read the Auth0 General Contribution Guidelines.
- [x] I have reviewed my own code beforehand.
- [x] I have added documentation for new/changed functionality in this PR.
- [x] All active GitHub checks for tests, formatting, and security are passing.
- [ ] The correct base branch is being used, if not
master.
I would appreciate it if you would approve running GitHub Actions for this PR when you have time.
@Widcket ping
@sergiught I fixed it, PTAL.
Codecov Report
Base: 89.05% // Head: 89.09% // Increases project coverage by +0.03% :tada:
Coverage data is based on head (
2bc0d47) compared to base (e9dbfc6). Patch coverage: 100.00% of modified lines in pull request are covered.
Additional details and impacted files
@@ Coverage Diff @@
## master #165 +/- ##
==========================================
+ Coverage 89.05% 89.09% +0.03%
==========================================
Files 7 7
Lines 274 275 +1
==========================================
+ Hits 244 245 +1
Misses 23 23
Partials 7 7
| Impacted Files | Coverage Δ | |
|---|---|---|
| validator/validator.go | 88.75% <100.00%> (+0.14%) |
:arrow_up: |
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.
:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.
Hey @osamingo 👋🏻 thanks a lot for the changes and apologies it took so while to get back to you! Would you mind adding a test case for this as well in the validatior_test.go file? 🙏🏻
Hey @osamingo 👋🏻 I had some time and went ahead and added the test cases missing. Thanks for the contribution again!