Documentation / Privacy and security compliance

4. Code review findings

The authentication and session basics are well built; the gaps are in accountability, data-subject tooling and secret handling. Controls found in the code:

AreaWhat the code doesSource
Password storagescrypt (N=16384, r=8, p=1), 16-byte random salt, constant-time compare; unknown users cost the same time as known oneslib/auth.js
Brute forceAccount locks for 5 minutes after 5 failures; 20 login requests a minute per client addresslib/auth.js, server.js
Sessions32-byte random token, only its SHA-256 stored; 12-hour expiry extended on use; deleted on logout, on password change and when a user is deactivatedlib/auth.js
CookieHttpOnly, SameSite=Strict, Secure when served over HTTPS or when COOKIE_SECURE=1server.js
Cross-site requestsSec-Fetch-Site and Origin checks reject cross-site writesserver.js
AuthorisationPer data source, per application feature and per FHIR® resource type; every Viewer and genome call checks itlib/access.js, lib/genomics.js
Stored documentsServed with nosniff and a sandbox policy so uploaded HTML or SVG cannot run scriptslib/documents.js
ResponsesCache-Control: no-store on API calls; no third-party scripts or CDNs in the pagesserver.js
Genome lookupsServer-side only; send gene symbols, accessions and HGVS text, never patient data or sequences; 24-hour cache; admin switchlib/genomeinfo.js
Sample dataSynthetic patients; genome variants are published biology, not real peoplesample-data/

What is missing or weak (details and ratings in section 8):

  • Accountability. The only logging is console.log and console.error for start-up, factory reset and failures. Reads of patient records, exports, login successes and failures, permission changes and user deletions leave no durable record (G1, G17).

  • Sign-in. One factor only; the minimum password is 8 characters with no complexity or breach check; a default admin / password account is created on first start and only a warning is shown (G2). scrypt cost is below current OWASP guidance (G10).

  • Secrets. Data-source connection strings, including passwords, are stored as plain text in auth.vault (G5).

  • Rights and retention. No function finds all data for one person, exports it, corrects it or hard-deletes it; the vault stores history with load_end_dts and is_deleted flags (G3). There is no retention schedule (G4).

  • Sessions. The 12-hour window slides on every use, so a workstation left open never times out (G7).

  • Granularity. Access stops at the resource type; there is no per-patient restriction, field masking or emergency-access ("break-glass") path (G8).

  • Throttle. The limiter keys on the socket address, so behind a reverse proxy every user shares one bucket, and its map is never pruned (G9).

  • Transport and headers. The server speaks plain HTTP and has no HSTS or Content-Security-Policy on its own pages (G6, G11).

  • Outbound lookups. Genome lookups are on by default and contact US and EU hosts (G12).