feat: harden auth and study workflows

- replace plaintext login and unlock requests with RSA-OAEP/AES-GCM encrypted payloads

- add login challenge replay protection, production RSA key validation, and auth tests

- wire compose to environment-driven dev/prod settings without committing local secrets

- update setup-config smoke scripts and Postman docs for encrypted login

- add visit schedule migrations/tests and update study/subject setup workflows
This commit is contained in:
Cheng Zhou
2026-05-08 22:13:12 +08:00
parent a7bbcaa5dc
commit 74feca4467
47 changed files with 2423 additions and 534 deletions
@@ -0,0 +1,47 @@
"""remove summary and objective note fields
Revision ID: 20260508_02
Revises: 20260508_01
Create Date: 2026-05-08 15:55:00.000000
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
revision: str = "20260508_02"
down_revision: Union[str, None] = "20260508_01"
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None
def upgrade() -> None:
bind = op.get_bind()
bind.execute(
sa.text(
"""
UPDATE study_setup_configs
SET published_project_snapshot = published_project_snapshot - 'summary_note' - 'objective_note'
WHERE published_project_snapshot IS NOT NULL
"""
)
)
bind.execute(
sa.text(
"""
UPDATE study_setup_config_versions
SET published_project_snapshot = published_project_snapshot - 'summary_note' - 'objective_note'
WHERE published_project_snapshot IS NOT NULL
"""
)
)
op.drop_column("studies", "objective_note")
op.drop_column("studies", "summary_note")
def downgrade() -> None:
op.add_column("studies", sa.Column("summary_note", sa.Text(), nullable=True))
op.add_column("studies", sa.Column("objective_note", sa.Text(), nullable=True))