Add passwordCommand option for SQL datastore credentials#9879
Merged
simvlad merged 1 commit intotemporalio:mainfrom Apr 15, 2026
Merged
Add passwordCommand option for SQL datastore credentials#9879simvlad merged 1 commit intotemporalio:mainfrom
simvlad merged 1 commit intotemporalio:mainfrom
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8de94ce5c9
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
yycptt
reviewed
Apr 14, 2026
Member
yycptt
left a comment
There was a problem hiding this comment.
hmmm RefreshingConnector implementation is not committed?
824b111 to
922a2d0
Compare
Contributor
Author
|
Ugh, committed |
922a2d0 to
c5b2507
Compare
yycptt
approved these changes
Apr 15, 2026
c5b2507 to
2a95572
Compare
This was referenced Apr 23, 2026
prathyushpv
added a commit
that referenced
this pull request
Apr 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed?
Add a
passwordCommandconfig option for SQL datastores that executes an external command to fetch the database password instead of using a staticpasswordfield. When configured, each new physical database connection re-executes the command to get a fresh credential viaRefreshingConnector, enabling short-lived tokens (e.g. cloud IAM tokens) to be used as database passwords. Supported for MySQL, PostgreSQL (both pgx and pq drivers).Why?
Cloud-managed databases (e.g. AWS RDS, GCP Cloud SQL) authenticate using short-lived IAM tokens rather than static passwords. There was no way to integrate an external credential source into Temporal's SQL config without forking the code.
passwordCommandlets operators plug in any token-fetching tool (e.g.aws rds generate-db-auth-token) via config.This approach is vendor-agnostic: any command that writes a password to stdout works, with no SDK dependencies or provider-specific code in Temporal.
How did you test it?
Tested with GCP, setting up a Postgres database and using it for the server backend
Potential risks
passwordCommandexecutes an arbitrary external command. Misconfiguration will cause connection failuresMaxConnLifetime, there is no built-in mechanism to detect or handle expired credentials on existing connections. Richer integration (e.g. parsing expiry from the command output and automatically setting connection lifetime) is possible but intentionally omitted here as it would be vendor-specific. The good news, is that most cloud APIs return tokens with a known, fixed TTL (e.g. 15 minutes for AWS RDS, 1 hour for GCP Cloud SQL).