BiblioViva Documentazione
Documentazione tecnica

Security

BiblioViva is a staff-only application for a school library whose patrons are mostly minors. This page records how the checklist of PLAN.md §3.15 is met, where each measure lives in the code and which test keeps it in place (review of step 9.1). It is for maintainers; the school's administrators find the operational part in the setup guides.

Exposure

Authentication and authorisation

Headers

Set in src/hooks.server.ts and by SvelteKit (csp in vite.config.ts), checked by tests/e2e/security.spec.ts:

Uploads and files

Reports

Report SQL runs on a separate read-only connection (mode=ro, PRAGMA query_only), after a static check that allows one SELECT/WITH statement, no write or administrative keyword, only declared :name parameters (src/lib/server/reports/safety.ts); values are always bound, never concatenated; uploaded definitions are also compiled against the database before they are installed. Tests: safety.test.ts (hidden second statements, case and comment tricks, quoted keywords) and run.test.ts (an injection attempt in a text parameter changes nothing; the connection refuses writes even if the check were bypassed).

Privacy

Names, photos and card numbers are never logged; the audit log records accounts and ids, not personal data; exports, backups and archives stay on the school's server unless an administrator downloads them. Removing a patron anonymizes it at once and for good. Seed and test data are synthetic.

Secrets

Secrets live only in environment variables declared in src/env.ts, never in the configuration folder or the repository: the Tailscale auth key (compose file) and, when the Google Books providers are enabled, GOOGLE_BOOKS_API_KEY (step 9.1 moved it out of metadata; a key left in config.json is ignored with a warning). The configuration archive and the backups never carry them.

Dependencies

Every dependency is pinned to an exact version (bun.lock committed); bun audit runs in the CI workflow.

Known trade-offs and future work

Indice A–Z