feat: protect postbox message content

This commit is contained in:
2026-08-02 03:40:57 +02:00
parent 7d310d5c33
commit 8f8d259a76
12 changed files with 611 additions and 29 deletions
+13
View File
@@ -11,6 +11,7 @@ from sqlalchemy import (
Index,
Integer,
JSON,
LargeBinary,
String,
Text,
UniqueConstraint,
@@ -145,6 +146,9 @@ class PostboxTemplateRevision(Base, TimestampMixin):
default="plaintext_v1",
nullable=False,
)
encryption_vault_id: Mapped[str | None] = mapped_column(
String(255), nullable=True
)
history_policy: Mapped[dict[str, Any]] = mapped_column(
JSON,
default=dict,
@@ -420,6 +424,9 @@ class PostboxMessage(Base, TimestampMixin):
)
subject: Mapped[str] = mapped_column(String(1000), nullable=False)
body_text: Mapped[str | None] = mapped_column(Text, nullable=True)
body_ciphertext: Mapped[bytes | None] = mapped_column(
LargeBinary, nullable=True
)
status: Mapped[str] = mapped_column(
String(30),
default="delivered",
@@ -473,6 +480,12 @@ class PostboxMessage(Base, TimestampMixin):
String(1000),
nullable=True,
)
encryption_envelope_id: Mapped[str | None] = mapped_column(
String(255), nullable=True, index=True
)
encryption_resource_id: Mapped[str | None] = mapped_column(
String(36), nullable=True, index=True
)
signed_manifest_ref: Mapped[str | None] = mapped_column(
String(1000),
nullable=True,