element-hq / element-hq/synapse
Support authentication methods with short-lived credentials for PostgreSQL connections (e.g. Microsoft Entra ID)
- Dominant language
- Python
- Stars
- 4.6k
- Forks
- 600
- Avg merge
- 5d 22h
- Merged PRs (30d)
- 51
Description
**Is your feature request related to a problem?**
I'm running Synapse against Azure Database for PostgreSQL Flexible Server, deployed on Azure App Service. I'd like Synapse to connect to the database using standard Microsoft Entra ID authentication.
As far as I can tell, Synapse reads the database credential from homeserver.yaml once at startup and uses it for the lifetime of the process. With a token as the credential, the initial connections work, but reconnections after the token expires fail authentication.
**Describe the solution you'd like**
Some supported way for Synapse to obtain or refresh the database credential during the lifetime of the process, rather than it being fixed at startup.
**Describe alternatives you've considered**
A static password role scoped to the Synapse database (what I'm doing now — works fine, just not what I'd prefer).
**Additional context**
Happy to help test against Azure Database for PostgreSQL Flexible Server.
Contributor guide
Research direction
Start by tracing how Synapse reads the database credential from homeserver.yaml and how PostgreSQL connections are created and re-established. Determine where a credential refresh could occur during the process lifetime, then verify that expired short-lived credentials are refreshed before reconnection and that existing static-password behavior remains supported.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, postgresql, python
- Domain
- authentication, backend, database
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100