Skip to content

Update security spec to reflect implemented sqlx approach - #45

Merged
Pino de Candia (pinodeca) merged 1 commit into
mainfrom
pinodeca/sec-model
Mar 9, 2026
Merged

Update security spec to reflect implemented sqlx approach#45
Pino de Candia (pinodeca) merged 1 commit into
mainfrom
pinodeca/sec-model

Conversation

@pinodeca

Copy link
Copy Markdown
Contributor

Summary

Updates spec-security-model.md to reflect the actual implemented user isolation approach (sqlx per-user connections) rather than the originally-proposed SPI + SetUserIdAndSecContext() approach.

Also corrects the documentation of df.in_workflow across all docs and source code.

Changes

  • spec-security-model.md: Replace SPI + SetUserIdAndSecContext references with the implemented sqlx per-user connection approach (connect_as_user with login_role/submitted_by)
  • New Section 8.8: Analysis of SPI as a potential future optimization — what it would bring (stronger escape prevention, no pg_hba.conf dependency) vs. why sqlx was chosen (async compatibility, concurrency, simplicity)
  • T0 mitigation update: GetOuterUserId() correctly handles SECURITY DEFINER (captures caller, not definer) — residual risk reduced from High to Low
  • df.in_workflow correction: All docs and source now accurately state it only guards variable mutations (setvar/unsetvar/clearvars), not recursive df.start() — noted as potential future improvement
  • Updated user-isolation.md, user-isolation-review.md, src/types.rs to match

- spec-security-model.md: Replace SPI + SetUserIdAndSecContext
  references with the implemented sqlx per-user connection approach
  (connect_as_user with login_role/submitted_by)
- Add Section 8.8 analyzing SPI as a potential future optimization
- Update T0 mitigation: GetOuterUserId() handles SECURITY DEFINER
- Correct df.in_workflow docs: only guards variable mutations,
  does not yet prevent recursive df.start()
- Update user-isolation.md, user-isolation-review.md, types.rs
  to match corrected df.in_workflow behavior
@pinodeca
Pino de Candia (pinodeca) merged commit e8e0991 into main Mar 9, 2026
5 checks passed
@pinodeca
Pino de Candia (pinodeca) deleted the pinodeca/sec-model branch March 9, 2026 18:25
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