Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Connection error message leaks Postgres password #428

Open
SanjayVas opened this issue Apr 9, 2024 · 1 comment
Open

Connection error message leaks Postgres password #428

SanjayVas opened this issue Apr 9, 2024 · 1 comment

Comments

@SanjayVas
Copy link

Hi there,

Thank you for opening an issue. Please provide the following information:

Terraform Version

1.7.5

Affected Resource(s)

  • postgresql_grant

Terraform Configuration Files

https://github.com/world-federation-of-advertisers/cross-media-measurement/tree/main/src/main/terraform/gcloud/cmms

Debug Output

Avoiding adding full debug output to do sensitivity. See edited snippet:

Error: Error connecting to PostgreSQL server  (scheme: gcppostgres): gcppostgres: open gcppostgres://postgres:<URL-escaped plaintext password>:5432/postgres?fallback_application_name=Terraform+provider: :5432/postgres is not in the form project/region/instance/dbname

The text <URL-escaped plaintext password> instead had my actual URL-escaped DB password.

Expected Behavior

Password is obfuscated in error message.

Actual Behavior

Password shown in error message.

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

  1. terraform plan -replace google_sql_database_instance.postgres

References

It looks like there's an attempt at using string.Replace in

errString := strings.Replace(err.Error(), c.config.Password, "XXXX", 2)
, but it does not appear to take into account that the password may be URL-escaped.

@gojanpaolo
Copy link

We just now encountered the same issue. Also using GCP

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants