Skip to content

fix: restore analytics user password via shell interpolation#17

Merged
passcod merged 1 commit intomainfrom
fix/analytics-password
Mar 18, 2026
Merged

fix: restore analytics user password via shell interpolation#17
passcod merged 1 commit intomainfrom
fix/analytics-password

Conversation

@passcod
Copy link
Member

@passcod passcod commented Mar 18, 2026

The \getenv + psql variable approach (:'analytics_password') introduced by an auto-fix review suggestion on #15 does not work reliably in a heredoc context. The result is that the password set by \getenv is either empty or not applied, and since the restore job clears all role passwords before this block runs, the analytics user ends up with no password and can't log in.

Reverts to shell variable interpolation ('${ANALYTICS_PASSWORD}'). This is safe because ANALYTICS_PASSWORD is generated by the operator (generate_password in replica.rs) and stored in a Kubernetes secret — it is not user-controlled input. A comment explaining this is added inline.

To fix an affected instance manually:

ALTER ROLE analytics WITH PASSWORD '<password from creds secret>';

🦸 Review Hero

  • Run Review Hero
  • Auto-fix review suggestions
  • Auto-fix CI failures

The \getenv + psql variable approach introduced by the auto-fix review
does not work reliably in a heredoc context, leaving the password unset
after the restore job clears all role passwords.

ANALYTICS_PASSWORD is generated by the operator (generate_password in
replica.rs) and stored in a Kubernetes secret - it is not user-controlled
input, so shell interpolation into the SQL string is safe.
@passcod passcod merged commit 838318d into main Mar 18, 2026
16 checks passed
@passcod passcod deleted the fix/analytics-password branch March 18, 2026 13:48
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

Successfully merging this pull request may close these issues.

1 participant