Skip to content

role-based credential mappings for PostgreSQL targets#1763

Closed
modanub wants to merge 2 commits intowarp-tech:mainfrom
modanub:feat/postgres-credential-mappings
Closed

role-based credential mappings for PostgreSQL targets#1763
modanub wants to merge 2 commits intowarp-tech:mainfrom
modanub:feat/postgres-credential-mappings

Conversation

@modanub
Copy link

@modanub modanub commented Mar 7, 2026

Allows configuring per-role database credentials on PostgreSQL targets. When a user connects, their Warpgate roles are matched against the target's credential mappings and the first match determines which upstream DB username/password is used. Falls back to the target's default credentials if nothing matches.

Use case: different user groups (admins, developers) connect through the same Warpgate target but get different PostgreSQL privilege levels without needing separate targets.

Changes:

  • PostgresCredentialMapping struct in target config (role → username/password)
  • get_user_roles() on ConfigProvider trait
  • credential selection in the Postgres session's run_authorized flow
  • admin UI for managing mappings on Postgres targets

modanub added 2 commits March 7, 2026 09:08
…gets

Allow mapping Warpgate roles to different PostgreSQL credentials per target.
When a user connects to a PostgreSQL target, their Warpgate roles are checked
against the configured credential mappings. The first matching role determines
which database username/password is used for the upstream connection. If no
role matches, the target's default credentials are used.

This enables multi-tenant database access patterns where different user groups
(e.g. admins, developers) connect through the same Warpgate target but
authenticate to PostgreSQL with different privilege levels.

Changes:
- Add PostgresCredentialMapping struct to target config
- Add get_user_roles() to ConfigProvider trait
- Implement role-based credential selection in PostgreSQL session
- Add credential mappings UI in admin panel target editor
@Eugeny
Copy link
Member

Eugeny commented Mar 10, 2026

Thank you for the contribution! Unfortunately, this is not in the scope of the project. If any connection properties (such as target username) must change in response to the user roles, I prefer there to be multiple targets.

@Eugeny Eugeny closed this Mar 10, 2026
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.

2 participants