20260802_471_enterprise_identity_hardening.py 689 B

123456789101112131415161718192021222324
  1. """Harden enterprise identity secret references."""
  2. from alembic import op
  3. revision = "20260802_471"
  4. down_revision = "20260802_470"
  5. branch_labels = None
  6. depends_on = None
  7. def upgrade() -> None:
  8. op.execute(
  9. """
  10. ALTER TABLE public.identity_idp_config_versions
  11. DROP CONSTRAINT IF EXISTS identity_idp_config_versions_secret_ref_check;
  12. ALTER TABLE public.identity_idp_config_versions
  13. ADD CONSTRAINT ck_identity_idp_secret_ref_dataops_oidc
  14. CHECK (secret_ref ~ '^env:DATAOPS_OIDC_[A-Z0-9_]+$');
  15. """
  16. )
  17. def downgrade() -> None:
  18. raise RuntimeError("Forward-only migration: identity secret boundary cannot be weakened")