Commit History
-
fix: harden privacy, access limits, drafts and graceful shutdown
DONG-WEI-YANGf609b94
-
fix(security): mount retrieveLimiter/createLimiter; make batch matching robust
DONG-WEI-YANG +1: Claude Sonnet 5retrieveLimiter (key-guessing protection) and createLimiter (storage abuse protection) were fully defined but never app.use()'d anywhere — record.retrieve/export.word/record.create only ever got the generic 100/min limiter. Generalizes the aiLimiter path-matching fix from an earlier commit into a reusable limiterForProcedure() helper that parses tRPC's `/trpc/proc1,proc2` batch path into individual procedure names and matches against any of them — closing the batch-ordering bypass for ALL per-procedure limiters at once (a plain path-prefix mount only ever inspects the start of the combined path, so a targeted procedure anywhere but first in a batch silently skipped the limiter). retrieveLimiter's original value (3/min, apparently never load-tested since it was dead code) turned out too strict once actually wired in — even the integration test suite's realistic call volume, sharing one IP across many test cases, tripped it and broke unrelated tests with garbled non-tRPC-shaped 429 res…fa1fd00
-
fix: comprehensive security hardening, iOS voice fallback, and UX resilience
DONG-WEI-YANG +1: Claude Opus 4.6 (1M context)- iOS voice fallback: MIME type detection + record-only mode when Web Speech API unavailable - HF Whisper fallback for audio transcription when Gemini fails - OpenCC s2twp layer in NLP pipeline for simplified→traditional Chinese conversion - localStorage draft autosave (useAutosave hook) across all 6 form pages - AI fill no longer overwrites user-entered fields (skip-if-filled pattern) - DB transaction wrapping for record creation (prevents orphaned data) - keyPrefix column for O(1) record lookup (replaces O(n) bcrypt scan) - Prompt injection fix: sanitizeForPrompt + Zod array/string constraints - Security headers: HSTS, X-Frame-Options, X-Content-Type-Options, Permissions-Policy - CSP: removed unsafe-eval, kept unsafe-inline for HF Spaces compatibility - AI-specific rate limiter (10 req/min), retrieve limiter tightened to 3/min - Crypto upgrades: bcrypt 10→12 rounds, key entropy 15→32 bytes - Role-recordType cross validation via Zod .refine() - fileName sanitization + file array .max(…94a07ff
-
feat: Group A foundation — scaffolding, schema, crypto, LTC3, types
DONG-WEI-YANG +1: Claude Opus 4.6 (1M context)- Project scaffolding: React + tRPC + Express + Drizzle + Vite - Database schema: records, genograms, ecomaps, encrypted_files, consent_logs, ltc3_codes, RAG tables - Crypto service: AES-256-GCM + HKDF + bcrypt + QR code generation - LTC 3.0 codes: 74 service codes with keyword matching + frequency extraction - Rate limiter: per-endpoint express-rate-limit - Shared types: all record schemas + role configs + constants - Authorization: 馬偕醫護管理專科學校智慧科技長期照顧科授權使用 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1cab9d0