mirror of
https://github.com/supabase/supabase.git
synced 2026-10-05 09:25:06 +03:00
fix(studio): show service role key in ConnectSheet for projects using legacy keys (#50516)
## I have read the [CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md) file. YES ## What kind of change does this PR introduce? Bug fix #50515 ## What is the new behavior? ConnectSheet now falls back to the legacy `service_role` key for projects using legacy JWT keys. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Improved secret-key resolution by falling back to the service key when a secret key is unavailable. * Prevented attempts to reveal a secret when no secret key identifier exists. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
1 parent
337ffaeb22
commit
7b4e3aba01
1 file changed
+2
-2
@@ -69,7 +69,7 @@ export function useConnectServerEnv(): UseConnectServerEnvResult {
|
||||
{ enabled: canReadAPIKeys }
|
||||
)
|
||||
const publishableKey = keys?.publishableKey?.api_key ?? keys?.anonKey?.api_key ?? ''
|
||||
const secretKey = keys?.secretKey
|
||||
const secretKey = keys?.secretKey ?? keys?.serviceKey
|
||||
const maskedValue = secretKey?.api_key
|
||||
? `${secretKey.api_key.slice(0, 15)}${SECRET_MASK}`
|
||||
: 'your-secret-key'
|
||||
@@ -79,7 +79,7 @@ export function useConnectServerEnv(): UseConnectServerEnvResult {
|
||||
isLoading: isRevealing,
|
||||
reveal,
|
||||
clear,
|
||||
} = useRevealedSecret({ projectRef, id: secretKey?.id })
|
||||
} = useRevealedSecret({ projectRef, id: secretKey?.id ?? undefined })
|
||||
|
||||
// toggle() and getSecretValue() can both decide to reveal before either
|
||||
// resolves (e.g. clicking "Reveal" and "Copy" in quick succession); share
|
||||
|
||||
Reference in new issue
Block a user