Skip to content

parity(client): unrecognized sb_ API key subtypes are silently accepted, no warning [from supabase-js] #278

Description

@grdsdev

SDK Parity: C# implementation needed

A change was made in supabase-js that needs to be implemented in this repository for SDK parity.

Reference Implementation (supabase-js)

  • Commit: c23e1ab
  • PR: #2526
  • Module: client (key handling)
  • Type: enhancement

What Changed

New API key formats are sb_publishable_… / sb_secret_…. Any other sb_-prefixed key is an unrecognized future subtype. supabase-js now warns once per subtype and continues, rather than throwing or silently ignoring it, so future key rollouts are visible to developers without hard-crashing existing clients.

Code Reference

const isNewApiKey = (key: string): boolean =>
  key.startsWith('sb_publishable_') || key.startsWith('sb_secret_')

export const checkApiKeyFormat = (key: string): void => {
  if (!key.startsWith('sb_') || isNewApiKey(key) || key.startsWith('sb_temp_')) return
  const subtype = key.match(/^sb_[a-zA-Z0-9]+_/)?.[0] ?? 'unknown'
  if (warnedKeySubtypes.has(subtype)) return
  warnedKeySubtypes.add(subtype)
  console.warn('@supabase/supabase-js: Unrecognized Supabase API key format...')
}

Confirmed in supabase-csharp: no sb_publishable_/sb_secret_ key-subtype validation exists anywhere in the client; the key is passed through as an opaque string with no classification or warning logic at all — an unrecognized future sb_ subtype would pass through silently with no signal to the developer.

Implementation Guidance

Expected API Surface

At client construction, classify the key and log a one-time-per-subtype warning for an unrecognized sb_-prefixed subtype. Never throw. Never log the raw key value.

Acceptance Criteria

  • Feature implemented matching supabase-js behavior
  • Public API follows C# naming conventions
  • Unit tests cover happy path and edge cases
  • No breaking changes to existing API

Context

  • supabase-js version: v3.0.0-next.29 / 2.110.6
  • Parity tracking: This issue was auto-generated by SDK parity analysis
  • Related parity issues: supabase-flutter (SDK-1319), supabase-py (SDK-1324), supabase-swift (SDK-1328), supabase-kt (#1356)

Generated with Claude Code /sync-sdk-parity

Metadata

Metadata

Assignees

Labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions