Files
CustosPublic/CLAUDE.md
T
mnovak 04a6031c5d [browser] Firefox: one extension source for Firefox, Edge and Chrome; frames, public suffixes, the caller check, 2FA codes and saving logins; v0.20.0
- custos-browser: fill_allowed (a frame gets a login only when its page would too), public suffixes match
  exactly only (psl), ports digits only, caller (which extension started the host); spoof tests.
- custos-native: answers not_allowed to anything but the Custos extension, browser_totp and browser_save,
  the frame's and the page's origins, a random session per connection (its match code on Custos's cards).
- extension/: manifest.firefox.json (gecko id custos@marek-novak.cz) and manifest.chromium.json, one set of
  scripts; the popup shows 2FA codes, the save offer and the connection's code; tools/extension.mjs builds
  each browser and reproducible zips; tools/extension-test.mjs runs the background against a fake browser.
2026-11-22 21:57:35 +01:00

5.1 KiB

Custos Domi — core (public)

Custos (Latin: guardian) is a local-first password and secret manager in the Domi ecosystem. This repository is the public, MPL-2.0 core: everything that touches plaintext or keys. The Windows app lives in the private Custos repo and depends on this one by git tag.

Layout

crates/custos-vault   file format, Argon2id + XChaCha20-Poly1305, atomic save, item model, SecretString
crates/custos-gen     memorable password, nickname, random, PIN, strict-site, secret-key and API-key generators
crates/custos-keys    key pairs (Ed25519, ECDSA P-256, RSA) as OpenSSH and PKCS#8 PEM
crates/custos-totp    TOTP / HOTP (RFC 6238 / 4226 vectors are tests), otpauth:// parsing
crates/custos-qr      QR payload strings (Wi-Fi escaping); rendering is the app's job
crates/custos-seal    sealed boxes (X25519 + XChaCha20-Poly1305) for factor material through a mailbox; at-rest sealing
crates/custos-team    team vaults' pure parts: member keys, policy evaluation, sign.request, approval statements, proofs
crates/custos-share   private share links: XChaCha20-Poly1305 blob, key in the URL fragment, optional password
crates/custos-wasm    the browser build (web vault + share page): JSON `call` ABI, no wasm-bindgen; js/custos.mjs
crates/custos-kdbx    KeePass import (KDBX 3.1, 4) and export (KDBX 4); tools/kdbx/interop.sh checks it with keepassxc-cli
crates/custos-browser which login belongs on which page and frame (origins, public suffixes, no fuzzy matching),
                      which extension started the host, native messaging frames
crates/custos-native  the browser extension's native messaging host: five browser_* ops, rebuilt, to custos.exe's pipe only
extension/            the MV3 extension, one source for Firefox (custos@marek-novak.cz) and Edge/Chrome (fixed id
                      jchkapmceepdnlhagfppeckggaecdcmn); tools/extension.mjs builds each, tools/extension-test.mjs
docs/FORMAT.md        the vault file format, version 1 (versioned; change it before the code)
docs/FACTORS.md       version 2: any two factors open the vault; the machine store
docs/KEYS.md          secret keys, API keys and key pairs
docs/SEAL.md          sealed boxes and the match code
docs/SHARE.md         the share blob and link format (versioned like FORMAT.md)
docs/THREAT_MODEL.md  what is and is not protected
docs/IDENTITY.md      the Domi identity: the root key in the vault, the mnemonic order, signing certs
docs/KDBX.md          KeePass files: reading, writing, limits, the item mapping and what does not survive
docs/BROWSER.md       the browser extension: pieces, matching rule, messages, registration, threat model
docs/SIGNING.md       release signing keys, kinds, standing approvals, the audit log
docs/TEAM.md          team vaults (member slots, kind 6), policies, sign.request, proofs, cosign and Tauri envelopes

Commands

cargo test --workspace            # all mandatory tests
cargo test --workspace --release  # same, faster Argon2
node tools/extension-test.mjs     # the extension's background against a fake browser
node tools/extension.mjs --zip    # target/extension/{firefox,chromium}/ and their zips
# the browser build, with the server's toolchain (WSL + Nix here; nixpkgs rev as in the Custos flake):
nix shell nixpkgs#cargo nixpkgs#rustc nixpkgs#stdenv.cc nixpkgs#lld -c \n  cargo build --release --target wasm32-unknown-unknown -p custos-wasm
node crates/custos-wasm/js/test.mjs <custos_wasm.wasm> [<vault> <password>]   # the JS loader against it
  • .cargo/config.toml selects getrandom's custom backend for wasm32: random_fill → crypto.getRandomValues.
  • WSL: run commands with wsl -d Debian --exec bash -lc '…'; plain wsl -- … expands $VARS too early. On the dev machine set CARGO_HOME=F:\C-Drive-Migration\future-caches\cargo (C: is off limits).

Rules

  • Commits: [<crate>] <Feature>: <description>, e.g. [vault] Format: authenticate slot parameters.
  • No AI attribution in commits or PRs, ever: no Co-Authored-By, no session links, no "Generated with".
  • No binaries in git.
  • No custom crypto. Only RustCrypto / rust-random crates (argon2, chacha20poly1305, hkdf, zeroize, rand with SysRng; for key pairs ssh-key, p256, rsa and ed25519-dalek, RustCrypto's Ed25519 backend; x25519-dalek for sealed boxes; for KeePass files aes, cbc, chacha20, salsa20, hmac, sha2). Randomness from the OS CSPRNG only.
  • Secrets never in logs, panics, error messages, Debug/Display output or test snapshots. Secret-holding types print [redacted]; there is a test for each one.
  • Tests here are mandatory (it is public and holds the crypto). A format change updates docs/FORMAT.md first, then a test, then the code.
  • Branch → PR on Gitea (token in $GITEA_TOKEN, never echoed) → self-review in the PR body → merge --no-ff → push → git rev-parse HEAD origin/main → tag vX.Y.Z (the private app pins tags).

Known traps

  • cargo fmt --all reformats files that are not rustfmt-clean on main (custos-keys, custos-seal, custos-wasm and some tests): run rustfmt --edition 2024 <file> on the files you changed, so a PR carries no unrelated churn.