Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Google Cloud deployment returns a 500 error when the client secret file is not valid JSON

Aperta Adatta ai principianti
#10,673 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
78/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
google-cloud, python
Ambito
backend, cloud

Direzione di ricerca

Inizia leggendo verify_credentials() in web/pgadmin/misc/cloud/google/__init__.py e segui il percorso dei suoi errori fino alle risposte HTTP. Controlla i casi descritti nell’issue: JSON non valido, UTF-8 non valido, client secret malformato e file mancante. Il lavoro è completato quando ogni caso restituisce una risposta Bad Request normale e chiara e, se il file manca, viene usato l’errore esistente “Client secret path not found”.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Bug

Describe the bug

In the Google Cloud deployment wizard, selecting a client secret file that is not valid JSON makes the "Click here to authenticate yourself to Google" step fail with an internal server error (HTTP 500), instead of saying that the file is invalid.

verify_credentials() in web/pgadmin/misc/cloud/google/__init__.py calls json.load() on the file without handling errors. A file that isn't JSON, isn't UTF-8, or doesn't have the structure of a Google OAuth client secret raises an exception that is not caught. A request without client_secret_file fails the same way, because unquote(None) raises TypeError.

To Reproduce

  1. Start Deploy Cloud PostgreSQL and choose Google Cloud.
  2. Select any file that is not a Google client secret JSON file (e.g. a .sql or text file) as the client secret file.
  3. Click the button to authenticate with Google.
  4. The request returns a 500 error.

Expected behavior

A clear error such as "The client secret file is not a valid Google OAuth client secret JSON file.", returned as a normal bad-request response.

Error message

HTTP 500 Internal Server Error. The server log shows an uncaught json.decoder.JSONDecodeError (or UnicodeDecodeError for a non-UTF-8 file).

Desktop (please complete the following information):

  • OS: any
  • pgAdmin version: 9.18 (also current master)
  • Mode: Desktop and Server
  • Package type: any

Additional context

Catching ValueError (which covers JSONDecodeError and UnicodeDecodeError), and checking that the expected keys are present, before creating the Google object would fix it. A missing client_secret_file should return the existing "Client secret path not found" error.

Lingua principale
Python
Stelle
3.9k
Fork
910
Merge medio
1g 15h
PR unite (30g)
39

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di pgadmin-org/pgadmin4

Tutte le issue di pgadmin-org/pgadmin4

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.