Navigation: ← Security
This document states who the adversary is, what they control, and what is in and out of scope. It is
the frame for untrusted-input.md,
deserialization-safety.md, and
ffi-boundary.md. Notation follows docs/notation.md.
The process embedding libdictenstein wants to keep:
libdictenstein holds no secrets of its own; confidentiality and integrity of the stored terms are the caller's concern (see README §What this is not).
The adversary is whoever supplies data that reaches the library. Depending on how the embedding application is wired, they may control one or more of these inputs:
| Input | Reaches | Adversary can… |
|---|---|---|
| Term set — the strings inserted into a dictionary | from_terms, insert, insert_with_value, … | choose adversarial keys (very long, deeply shared, high-codepoint) |
| Query — the string passed to a lookup | contains, transition, substring search | choose adversarial queries (very long, non-matching) |
| Serialized blob — bytes loaded into a dictionary | deserialize (feature serialization / protobuf / compression) | craft a malformed or hostile encoding |
| Concurrency — the schedule of concurrent calls | any &self method | race readers against writers |
Foreign ABI caller — an independently compiled binary invoking the exported C surface (features ffi / bindings-core) | the 41 ldict_* entry points (src/ffi.rs); the exported vt.dictionary.v1 resource vtables (src/bindings.rs) | pass null or malformed arguments and descriptors; misuse the retain/release ledger; forge snapshot node ids; abuse paging parameters (start, capacity); supply hostile persistence paths; drive snapshot/arena allocation; race calls against free |
| Foreign vtable / resource (inbound, family-level) | none in this crate — libdictenstein produces resources and consumes none | (defended by consumers; see the family security model) |
The adversary does not control the process's code, its other memory, or the filesystem beyond what the application hands the library.
The library's job at each inbound boundary is to fail safely — return an Err/Option, or
bound the work — rather than corrupt memory, panic on attacker input, or consume unbounded
resources.
Result/Option. Enumerated in untrusted-input.md §Panic surface.unsafe code under any input and any concurrent schedule. Bound to contracts
in unsafe-contracts.md.ldict_* C ABI (host role: total validation, catch_unwind containment, thread-local errors) and
through the exported resource vtables (producer role: ledger misuse, node-id forgery, paging
abuse, path policy, exhaustion). Analyzed vector-by-vector in ffi-boundary.md,
which instantiates the
family security model
for this repository.mmap / io_uring /
fsync semantics and the integrity of the underlying block device; a hostile kernel or a
bit-flipping disk is not modeled (though torn-write crash recovery is — see
persistence).The safety claims are not merely asserted:
unsafe inventory is CI-gated for drift; see unsafe-contracts.md.scripts/check-bindings.py, CI job binding-contract) pins the
exported ABI surface — symbol parity, status/kind/capability values, header identity — against
the machine-readable model bindings/api.json; the boundary's
behavioral claims and their scheduled executable/formal pinning are tracked in
ffi-boundary.md §Verification status.Can you improve this documentation?Edit on GitHub
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |