Commit 7ec2eda
committed
feat(sdk): add per-request user impersonation to Context
Adds ctx.impersonate() with callback (auto-revert) and explicit
(caller-managed) modes. Borrows a dedicated pool connection via
Kysely's .connection() API, switches identity with dialect-specific
SQL (EXECUTE AS USER for MSSQL, SET ROLE for PostgreSQL), and
guarantees revert even on throw. Unsupported dialects throw at
call time. Includes username validation and dialect-specific quoting
for SQL injection prevention.1 parent 359c28e commit 7ec2eda
18 files changed
Lines changed: 2755 additions & 9 deletions
File tree
- .changeset
- docs/superpowers
- plans
- specs
- src
- core/runner
- sdk
- impersonate
- tests
- core/template
- integration
- error-diagnostics
- impersonate
- sdk/impersonate
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
0 commit comments