> Historical edition notes. Current capabilities and audience are documented in [the third-edition audit](09-third-edition-audit.md); nationwide data and additional sign-in setup are in [the current integration guide](10-nationwide-and-auth.md). The public preview retains private account data.

# Quickgency — security, privacy and operations

## Implemented controls

Owner-private hosting; dispatch-owned sign-in; server-side ownership checks; separate admin allowlist; strict payload schemas; same-origin mutation guard; parameterized SQL; per-actor persistent action rate limits; duplicate/idempotency constraints; optimistic mutation transactions; private response caching; no public phone/location projections; request-specific expiring consent; demo isolation; noindex metadata; profile erasure and audit trail.

Phone fields exist only as future schema boundaries. No encryption key or phone provider has been configured, and no phone number is currently collected. Do not describe unused `phone_cipher` fields as an implemented encryption system. Contact-consent records authorize a workflow transition only; no phone reveal endpoint exists.

## Threat model and residual work

| Risk | Current response | Before real operations |
|---|---|---|
| Account/role impersonation | Hosted identity boundary, role allowlist | Verify origin cannot bypass dispatch; review account recovery and operator provisioning |
| Cross-account data exposure | Scoped drafts/demo data; only own donor response visible | Independent authorization/IDOR and log review |
| Repeated or stale contact | Deduplication, availability expiry, closed-state and consent checks | Donor-wide cooldown, queue reservations, suppression/block rules |
| Fraudulent donation credit | Independent reviewer, pending/verified distinction, unique ledger | Evidence handling, disputes, reversals and permission separation |
| Harassment or false requests | Report queue, rate limits, private drafts | Staffed escalation, block/suspension, requester verification |
| Oversharing sensitive health data | No patient/report upload fields; minimal request form | Review free-text fields, retention, breach response, consent policy |
| Stale social preview | Current request page, no-store request image, closed state | External crawler/cache checks after an authorized public launch |
| Third-party notification failure | External sending disabled | Durable outbox, provider idempotency, signed callbacks, capped retries and dead-letter handling |
| Availability/performance | Indexed bounded queries, small interface assets | Load tests, monitored error budget, recovery drill |

Rate-limit rows and effective expirations have no periodic purge job. A streaming JSON reader enforces a 16,000-byte limit. Edge abuse controls still need hardening for an adversarial public service. This is not a security certification.

## Privacy and legal review

The research report identifies Bangladesh's Personal Data Protection Act 2026 and links the official text. This build does not certify compliance. Obtain qualified review of controller/processor roles, consent, health data, minors, data location/transfers, deletion/retention, access requests and incident response before live collection.

Account erasure removes profile identity/location/phone placeholders, withdraws contact grants and cancels open owned requests. Minimal pseudonymous workflow and audit references remain. A documented retention schedule and automatic purge are outstanding. The current export covers the dashboard, not every audit/report record that a formal access request might require.

## Operational workflow

A real service needs named people and coverage. The proposed workflow is: verify requester → check need with hospital → offer a small donor batch → record acceptance → obtain contact consent → coordinate hospital handoff → capture outcome → independent review → close remaining need or escalate. Do not turn failed screening into a public diagnosis or assign blame to a donor.

Declines/withdrawals must be frictionless. If the request cannot be met, mark it unresolved and direct the requester to the receiving hospital's blood service; do not invent a hotline or guarantee a match. Any real messages, hospital engagement and public launch require separate authorization.

## Deployment and environment

| Variable/binding | Purpose | Current requirement |
|---|---|---|
| `DB` | Provisioned Sites D1 binding | Required; `.openai/hosting.json` declares it |
| `QUICKGENCY_ADMIN_IDS` | Comma-separated site-scoped user IDs | Optional; absent denies operator access |
| `BUCKET` | Reserved type declaration only | Unused; R2 is null in manifest |
| Provider credentials | Future OTP/SMS/email/push | None configured; do not put secrets in source |

Build with the Sites `build-site.mjs` helper. Generate schema changes through Drizzle and inspect migration SQL. The Sites source helper commits/pushes the source and packages the matching build. Publish owner-private through the native Sites operation. The platform applies packaged D1 migrations. Never reuse another project's identity, credential or data. Keep credentials in session memory/stdin only.

For release recovery, retain the prior Site version and use a reviewed rollback. Database changes should be additive where possible; reverting source alone does not reverse a migration. Backups, restore testing, alert ownership and incident communication are not yet validated.
