# Assurance case

> Why CtrlAltNotes meets its security requirements: threat model, trust boundaries, secure design principles, and how common weaknesses are countered.

Source: https://ctrlaltnotes.com/docs/technical/assurance-case · Last updated: 2026-12-04 · License: AGPL-3.0

This page argues that CtrlAltNotes meets its security requirements, and points to the evidence. It
ties together the [security model](13-security-model.md), the [architecture](01-overview.md), the
[hardening checklist](19-hardening.md), the [pentest report](14-pentest-report.md) and the
[known limits](15-known-limits.md).

## Claim

Note titles, bodies, attachments and folder structure can be read only by someone who has the
vault password, the recovery key or an enrolled security key, both on disk and in the sync folder;
and a note cannot be changed or replaced without the change being detected.

## Threat model

The adversaries and what each can and cannot do are listed in the
[security model](13-security-model.md#adversaries): the cloud provider or anyone with the synced
folder, a thief of the vault folder, other local users and processes (web version), and malicious
note or import content. Malware on the unlocked computer is out of scope, and so is anyone who
knows the password.

## Trust boundaries

1. **Sync folder and vault files**: untrusted. Every object is authenticated (ChaCha20-Poly1305
   with the object id, type and a per-file salt as associated data, so a file cannot be moved to
   another id or type) and strictly validated after
   decryption; anything else is rejected as corrupt. See [Vault format](02-vault-format.md).
2. **UI ↔ host**: the UI is treated as an untrusted input producer. It never receives or sends a
   file path; every command argument is validated by the service. See
   [Architecture](01-overview.md#layers-and-trust-boundaries).
3. **Web version ↔ other local processes**: loopback only, a 256-bit random token, Host and Origin
   checks, size and time limits. See [Web host](07-web-host.md).
4. **Imported files and note content**: untrusted. Parsed with bounded, fuzzed parsers; rendered
   with DOM calls only, never HTML strings; no script, no remote content. See
   [Note features](20-note-features.md#import).
5. **Dependencies and build**: crates.io only, locked versions, audited on every change; releases
   built only by GitHub Actions from signed tags, with attestations. See
   [Building](11-building.md#how-dependencies-are-chosen-and-tracked).

## Secure design principles applied

| Principle | How |
|---|---|
| Economy of mechanism | One AEAD (ChaCha20-Poly1305), one KDF (Argon2id), HKDF for subkeys; no custom cryptography; a small UI with no third-party JavaScript |
| Fail-safe defaults | Auto-lock on idle, close and quit; sync off until a folder is chosen; anything that fails validation is rejected, not repaired |
| Complete mediation | Every API call goes through the service, which checks the vault is unlocked and validates arguments |
| Open design | All code, formats and tests are public; security does not depend on secrecy of the design |
| Separation of privilege | Vault key wrapped separately by the password, the recovery key and each security key; note locks use a separate password |
| Least privilege | The Tauri window gets no core permissions, only opening web and mail links; file dialogs are opened by the Rust side; CI tokens read-only by default |
| Least common mechanism | Each note is its own sealed file, so one damaged file affects one note |
| Psychological acceptability | Long passphrases without composition rules (NIST SP 800-63B-4), fingerprint/security-key unlock, a recovery key shown once |
| Defence in depth | Strict CSP and DOM-only rendering on top of input validation; per-note authentication on top of folder sync |

## Common weaknesses countered

| Weakness (CWE / OWASP) | Countered by | Evidence |
|---|---|---|
| Memory safety (CWE-119 family) | Rust with `#![forbid(unsafe_code)]` in every crate | source scan in `crates/core/tests/security.rs` |
| Weak or broken cryptography (CWE-327, CWE-916) | ChaCha20-Poly1305, Argon2id (64 MiB, t=3, p=4), RustCrypto crates | known-answer tests `crates/core/tests/kat.rs` |
| Tampering and swapped files (CWE-345) | AEAD with the object id, type and a per-file salt bound in; anything that fails is rejected; replaying one older object is blocked. Rolling back the whole vault to an older consistent copy is a [known limit](15-known-limits.md) | `crates/core/tests/security.rs` (tamper tests) |
| Cross-site scripting (CWE-79) | DOM APIs only, strict CSP, no `innerHTML`, safe link schemes | `tests/md_robustness.py`, `tests/e2e_ui.py` |
| Path traversal (CWE-22) | The UI never supplies paths; import paths are labels only; `..` rejected | import tests, fuzzing |
| Resource exhaustion (CWE-400) | Size, depth and count limits on every parser, zip bomb detection | fuzz targets, `tests/import_formats.py` |
| Brute force (CWE-307) | Argon2id plus an unlock back-off, separate back-off for note passwords | `crates/service/tests/service.rs` |
| CSRF / DNS rebinding on the web version | Bearer token, Host and Origin checks, loopback only | `crates/server/tests/http.rs` |
| Secrets in the repository (CWE-798) | gitleaks in the gate, a hook and CI | CI `secrets` job |
| Vulnerable dependencies (CWE-1395) | cargo audit, cargo deny, OSV-Scanner, Dependabot as required checks | [`SECURITY.md`](https://github.com/ctrlaltmg/ctrlaltnotes/blob/main/SECURITY.md#dependency-and-code-scanning-policy) |

## Evidence that it holds

* The automated tests, fuzzing and static analysis described in [Testing](12-testing.md) run on
  every change and block merges when they fail.
* The [penetration test](14-pentest-report.md) found and fixed issues, and records the controls that
  held.
* What is **not** protected is listed openly in [Known limits](15-known-limits.md) (for example
  file counts, sizes and times visible to the cloud provider, and the visible title of a locked note).

This case has not yet been reviewed by an independent auditor; that is on the
[roadmap](https://github.com/ctrlaltmg/ctrlaltnotes/blob/main/ROADMAP.md).
