Write Cloud SQL keyfile_dict credentials with 0600 permissions (#67507)
When the Google connection supplies credentials via ``keyfile_dict``, ``CloudSqlProxyRunner._get_credential_parameters`` wrote the credentials file with ``open(path, "w")``. That inherits the process umask (typically ``0o644`` on most distributions), leaving the service-account private key world-readable on shared worker hosts — including any other process on the same machine that can read the worker's temp directory. Use ``os.open(..., O_WRONLY | O_CREAT | O_TRUNC, 0o600)`` followed by ``os.fdopen`` so the file is created with restrictive permissions atomically. Matches the explicit-mode handling already used for the SSL temp files in the same module.
J
Jarek Potiuk committed
fc845cf64c0ab20e08890b3e0470d6c50368a260
Parent: ba36e02
Committed by GitHub <noreply@github.com>
on 5/28/2026, 4:54:11 PM