Security pack

ASVS level 2 self-assessment

Version 1.0, November 2026 · The whole pack · PDF

Hosted IMS Creator (app.imscreator.com, Stage A) against the Application Security Verification Standard, level 2, as at go-live. Met: in place, with evidence (a test, code or a setting). Partial: in place with a stated limit. Gap: not yet, with the plan. Chapters and requirement numbers are ASVS 4.0.3's. Reviewed by: the owner, before go-live; again before Stage B and after any major change. The independent penetration test (before Stage B or a third customer) checks this assessment.

Summary

Chapter Status The main points
V1 Architecture Met Documented design and threat model (CLOUD-ARCHITECTURE.md); tenancy enforced in one place (the host); isolation proven by tests on every build
V2 Authentication Met NIST 800-63B passwords, breached-password check, Argon2id, TOTP before the password, recovery codes, lockouts, emailed single-use resets
V3 Sessions Met Server-side sessions, 12 h idle / 7 days, revocable, ended on password, role and MFA changes; __Host- HttpOnly Secure SameSite=Strict cookie
V4 Access control Met Deny by default; company from the session only; roles checked per request; operators reach no company content (tests)
V5 Validation and encoding Met Pydantic models and typed routes; parameterised SQL (SQLAlchemy); React escaping; paths and uploads checked
V6 Cryptography Partial Standard libraries only (Argon2id, Fernet/AES, HMAC-SHA256); per-site and per-company keys, rotatable; master-key wrapping comes with Stage B
V7 Errors and logging Partial Audit log per company, hash-chained, exportable; no secrets or content in logs; central log shipping is a Stage B item
V8 Data protection Met No drawings kept; Claude keys sealed, never shown; caching off for the app shell; backups encrypted client-side
V9 Communications Met TLS 1.2+ at Cloudflare, HSTS, tunnel encrypted; internal services on the Docker network only
V10 Malicious code Partial Dependencies pinned and scanned (Trivy, pip-audit); production updates itself only to images its own CI built, tested and scanned, pinned by commit, with rollback; ClamAV on uploads when built in; code signing of images, and branch protection as the gate to production, are Stage B items
V11 Business logic Met Rate limits on sign-in steps; last-admin and break-glass protections; Claude spend alerts; batches limited in size and time
V12 Files and resources Met Uploads by content type, size and zip checks, outside the web root, deleted within 2 hours; downloads by id, path-checked
V13 API Met JSON API with CSRF header requirement, typed schemas, 413 above 110 MB, no API docs exposed on the host
V14 Configuration Partial Security headers and CSP; secrets in .env (mode 600); containers drop capabilities; containers still run as root

V1 Architecture, design and threat modelling

Req. Status Evidence
1.1.1-1.1.7 Secure development, threat model, components documented Met docs/CLOUD-ARCHITECTURE.md (sections 4, 5, 11, 12: components, tenancy, controls, threat model); this assessment
1.2 Authentication architecture Met One sign-in path (readiness/web/host.py); low-privilege database use per company database; operators separate from people
1.4 Access control architecture Met The host checks session, company, site and role before any site API; enforced in one place, not per route; tests/test_isolation.py
1.5 Input and output architecture Met Serialisation through Pydantic/JSON only; no deserialisation of untrusted objects
1.6 Cryptographic architecture Partial Keys per site and per company (rotate-keys); a master key (KMS) wrapping them is Stage B
1.8 Data protection Met Data classification (CLOUD-ARCHITECTURE.md 9.1); drawings not stored
1.9 Communications Met All external traffic through the Cloudflare tunnel; Postgres and MinIO not published
1.12-1.14 Uploads, configuration Met Separate temporary batch volume, excluded from backups; pinned images; deploy runbook

V2 Authentication

Req. Status Evidence
2.1.1-2.1.12 Password security Met 12-256 characters, any characters, no composition rules or expiry, breached-password check at setting (k-anonymity), paste allowed, change requires the current password (identity.password_problem, tests in test_signin.py)
2.2.1 Anti-automation Met 5 wrong codes: 15-minute lock; 10 wrong passwords: 1-hour lock; per-address limit (60 per 5 minutes); Cloudflare rate limits
2.2.2-2.2.3 Notify of authentication events Met Locks, authenticator resets and break-glass use are emailed
2.3 Authenticator lifecycle Met Invitations and resets by single-use, expiring links (7 days, 1 hour); no temporary passwords on the hosted service
2.4.1-2.4.5 Credential storage Met Argon2id (argon2-cffi defaults); older scrypt hashes rehashed at sign-in
2.5 Credential recovery Met Emailed reset link only; ends every session; does not bypass the authenticator
2.7-2.8 Out-of-band and one-time codes Met TOTP (RFC 6238), each code once (mfa_last_step), 10 hashed single-use recovery codes, secrets sealed with the company's key
2.10 Service authentication Met No default or shared service accounts in the app; database and store credentials only in .env

V3 Session management

Req. Status Evidence
3.2.1-3.2.3 Session binding Met 256-bit random session ids, only their hash stored; new id at each sign-in; cookie value signed
3.3.1-3.3.4 Logout and timeout Met Sign-out revokes server-side; 12 h idle, 7 days absolute; list and end other sessions; password change ends the others
3.4.1-3.4.5 Cookies Met __Host- prefix, Secure, HttpOnly, SameSite=Strict, Path=/ (test_hardening.py)
3.5 Token-based sessions n/a Not used
3.7.1 Re-authentication before sensitive changes Partial A password change needs the current password, removing an authenticator needs a code; other admin actions rely on the session (acceptable at 12 h idle; to revisit)

V4 Access control

Req. Status Evidence
4.1.1-4.1.5 General Met Deny by default (401/403 before any site route); the company is the session's, never a request's
4.2.1 IDOR Met Every GET route swept with the other company's names and ids (test_isolation.py, 70 routes, 200+ requests)
4.2.2 CSRF Met SameSite=Strict plus the X-ORT-Request header on every state-changing request (test_signin.py)
4.3.1 Admin interfaces Met Platform administration requires an administrator with an authenticator; from the internet only through Cloudflare Access as that administrator (its signed token checked on every request); reaches no company's site
4.3.2 Directory browsing Met No listings served; static assets by name only

V5 Validation, sanitisation and encoding

Req. Status Evidence
5.1 Input validation Met Pydantic models for settings; typed parameters; allow-lists for roles, regions, providers, kinds
5.2 Sanitisation Met File and path names cleaned (insider._safe, localfolder.rel, storage._check)
5.3 Output encoding Met React escapes by default; the two raw HTML insertions are the app's own help pages (from its Markdown) and the QR SVG it generates
5.3.4 SQL injection Met SQLAlchemy throughout; the few textual statements use bound parameters or fixed identifiers
5.3.8 OS command injection Met Subprocesses take argument lists, never a shell string
5.5 Deserialisation Met JSON and YAML safe_load only

V6 Stored cryptography

Req. Status Evidence
6.1 Data classification Met CLOUD-ARCHITECTURE.md 9.1
6.2.1-6.2.6 Algorithms Met Fernet (AES-128-CBC + HMAC-SHA256), Argon2id, SHA-256, HMAC-SHA256; no home-made crypto (TOTP per RFC 6238 with HMAC-SHA1, as the RFC)
6.3 Random values Met secrets / os.urandom for ids, tokens, keys
6.4.1-6.4.2 Key management Partial Keys per site and company, rotatable (rotate-keys, runbook); keys are files on the encrypted disk, not in a vault: KMS in Stage B

V7 Error handling and logging

Req. Status Evidence
7.1.1-7.1.4 Log content Met No passwords, codes, tokens or Claude keys logged; drawing content not logged
7.2 Security events Met Company audit log: sign-ins and failures with address, locks, roles, invitations, MFA, domains, Claude connections, key rotation, exports, break-glass
7.3.1-7.3.4 Log protection Partial Audit entries hash-chained (tampering shown on Company, test_hardening.py), exportable as CSV; application logs stay on the VM (capped); central shipping in Stage B
7.4 Error handling Met Generic messages to users; no stack traces in responses

V8 Data protection

Req. Status Evidence
8.1 General Met Drawings never stored (batches deleted within 2 hours, excluded from backups); per-company databases and bucket prefixes
8.2 Client-side Met No sensitive data in local storage (only the theme, and folder handles in IndexedDB); Cache-Control: no-cache on the app shell
8.3 Sensitive private data Met Claude keys never shown after saving; operators see counts, not content; export and deletion runbooks

V9 Communications

Req. Status Evidence
9.1 Client communications Met TLS 1.2+ (Cloudflare), HSTS (12 months), always HTTPS
9.2 Server communications Met Tunnel encrypted; Claude, Postmark, DNS-over-HTTPS and breach-check calls over TLS with verification; internal traffic on the private Docker network

V10 Malicious code

Req. Status Evidence
10.2 Malicious code search Partial Reviewed by the owner; no remote code loading; automatic updates take only the repository's own CI-built images (whoever can push to the branch reaches production, so pushes are the owner's)
10.3 Application integrity Partial Images built by CI from the repository, scanned (Trivy), pinned by commit; image signing in Stage B

V11 Business logic

Req. Status Evidence
11.1.1-11.1.8 Met Steps in order (code before password, within 2 minutes); limits on sign-in, upload size and batch count; the last company admin and the break-glass account protected; Claude use alerts

V12 Files and resources

Req. Status Evidence
12.1 Upload Met Size limits (500 MB a file, 110 MB a request); zip bombs refused (ratio, total, count); test_localfolder.py
12.2 Integrity Met Type by content, matching the name; SHA-256 checked on arrival
12.3 Execution Met Uploads never executed or served as-is; paths cannot leave the batch (rel, zip-slip check)
12.4 Storage Met Outside the web root, on a separate volume
12.5-12.6 Download and SSRF Met Downloads by id within the batch or store; no user-supplied URLs fetched by the server

V13 API

Req. Status Evidence
13.1 General Met Same authentication and authorisation for every API route
13.2 RESTful Met CSRF header on changes; JSON content type; methods per action; request size limit (413)

V14 Configuration

Req. Status Evidence
14.1 Build and deploy Met CI builds, tests (incl. isolation on Postgres) and scans; deploy runbook with staging
14.2 Dependencies Met Pinned, scanned in CI (Trivy, pip-audit)
14.3 Unintended disclosure Met No server paths or versions of components in responses to companies; API docs not on the host
14.4 HTTP security headers Met CSP (scripts by hash), X-Content-Type-Options, X-Frame-Options, Referrer-Policy, Permissions-Policy, COOP, HSTS (test_hardening.py)
14.5 Request validation Met Host header fixed by the tunnel; CORS not enabled
Container hardening (beyond ASVS) Partial no-new-privileges, all capabilities dropped, memory limits; still root inside, writable file systems: to change with a non-root image user

Fixed for go-live

Found by this assessment and fixed before go-live (commit with this file):

  • Security headers and a content security policy (V14.4) on the host and on a site of its own.
  • The session cookie bound to the host on HTTPS (__Host- prefix) (V3.4).
  • Requests over 110 MB refused before they are read (V13.2).
  • The company audit log hash-chained, its integrity shown, exportable (V7.3).
  • Dependency auditing in CI (pip-audit) beside the image scan (V14.2).
  • The restore drill automated on Postgres (tests/test_restore.py).
  • Earlier in the build: the drawing register's prompts no longer describe one company's drawings as another's; the Claude key never falls back to the host's own; links not spent by a password that is refused.

Open items

Item Plan
Master key (KMS) wrapping company keys (V6.4) Stage B (Key Vault / KMS)
Central, tamper-resistant log shipping (V7.3) Stage B
Re-authentication before sensitive admin actions (V3.7) Next release: re-enter the password or a code for role changes to company admin, break-glass and Claude connection changes
Containers as a non-root user, read-only file systems Next release: an amtoolkit user in the image, folder ownership set by the init service
Image signing (V10.3) Stage B (cosign)
Per-company Postgres roles Before the third customer
Independent penetration test Before Stage B or a third customer