fix(scan): decode supabase jwt body as base64url#348
Open
TBX3D wants to merge 1 commit into
Open
Conversation
jwt payloads are unpadded base64url, but the supabase detector decoded them with RawStdEncoding, which errors on any payload whose base64 lands on the url-safe - or _ characters and silently skips the token. mirror the jwt.go decoder: raw base64url with a padded fallback. extract the decode into parseSupabaseJwtBody so it is unit-testable off the network.
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #348 +/- ##
=======================================
Coverage ? 54.86%
=======================================
Files ? 81
Lines ? 6881
Branches ? 0
=======================================
Hits ? 3775
Misses ? 2836
Partials ? 270 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
pr summary2 files changed (+93 -13)
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
the supabase anon-key jwt body was being decoded with base64.RawStdEncoding, which rejects the url-safe - and _ characters that base64url actually uses. switched to a raw-url-encoding decode with a padded fallback for tokens that weren't stripped of padding, and added a nil check since a literal json null unmarshals into a nil pointer without an error.