Skip to content

fix(scan): decode supabase jwt body as base64url#348

Open
TBX3D wants to merge 1 commit into
vmfunc:mainfrom
TBX3D:fix/supabase-jwt-base64url
Open

fix(scan): decode supabase jwt body as base64url#348
TBX3D wants to merge 1 commit into
vmfunc:mainfrom
TBX3D:fix/supabase-jwt-base64url

Conversation

@TBX3D

@TBX3D TBX3D commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

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.

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.
@TBX3D
TBX3D requested a review from vmfunc as a code owner July 9, 2026 22:12
@github-actions github-actions Bot added scan changes to scan engine modules changes to scan modules tests test changes labels Jul 9, 2026
@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 76.47059% with 4 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (main@7ea1cd2). Learn more about missing BASE report.

Files with missing lines Patch % Lines
internal/scan/js/supabase.go 76.47% 3 Missing and 1 partial ⚠️
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions github-actions Bot added the size/m <200 lines changed label Jul 9, 2026
@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown

pr summary

2 files changed (+93 -13)

category files
go source 2
tests 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

modules changes to scan modules scan changes to scan engine size/m <200 lines changed tests test changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants