docs/THREAT-MODEL.md's "Known gaps" #6: the WAL and SQLite index are fully plaintext on local disk today. Add src/wal_crypto.rs: AES-256-GCM envelope encryption (pure Rust, no OpenSSL linking) keyed from RATION_LEDGER_ENCRYPTION_KEY (base64-encoded 32 bytes — a dev stand-in for a real KMS/Secrets Manager key, per this gap's own wording). Wire it into append_and_commit/replay_wal_into_index so every WalEvent is encrypted before wal_ffi::Wal::append ever sees it, and decrypted in the recovery callback before JSON deserialization. This is the correct boundary, not a compromise: wal_ffi's own interface already treats a payload as an opaque &[u8], so this requires zero changes to the C WAL's frame format, CRC, or recovery/truncation logic (services/wal/wal.c, docs/formal's TLA+ spec). Disabled by default (same opt-in posture as every other control here that changes an on-disk format); Ledger::open_with_encryption's doc comment spells out that this is not a live migration path. Verified live: the on-disk WAL file is genuine ciphertext (no plaintext tenant names, not valid JSON), a full seed/deposit/bridge-funding demo cycle runs correctly against an encrypted ledger, and two new integration tests prove a real restart-and-recover round trip plus loud failure on a wrong key.
72 lines
2.7 KiB
TOML
72 lines
2.7 KiB
TOML
[package]
|
|
name = "ledger-core"
|
|
version = "0.1.0"
|
|
edition = "2021"
|
|
|
|
[[bin]]
|
|
name = "ledger-core"
|
|
path = "src/main.rs"
|
|
|
|
[lib]
|
|
name = "ledger_core"
|
|
path = "src/lib.rs"
|
|
|
|
[dependencies]
|
|
# "tls" pulls in rustls so tonic::transport::{Identity, Certificate,
|
|
# ServerTlsConfig, ClientTlsConfig} are available — used by src/mtls.rs
|
|
# for mTLS between ledger-core and the other internal services (see
|
|
# docs/SCALE-EXPANSION.md section 8, pkg/mtls for the Go-side
|
|
# equivalent, infra/dev-ca/ for the dev CA that issues the certs).
|
|
tonic = { version = "0.12", features = ["tls"] }
|
|
prost = "0.13"
|
|
tokio = { version = "1", features = ["full"] }
|
|
rusqlite = { version = "0.31", features = ["bundled"] }
|
|
thiserror = "1"
|
|
uuid = { version = "1", features = ["v4"] }
|
|
tracing = "0.1"
|
|
tracing-subscriber = { version = "0.3", features = ["env-filter", "json"] }
|
|
serde = { version = "1", features = ["derive"] }
|
|
serde_json = "1"
|
|
opentelemetry = "0.33.1"
|
|
opentelemetry_sdk = "0.33.1"
|
|
# default-features = false + an explicit "grpc-tonic" exporter transport
|
|
# keeps this off the reqwest/http-exporter path entirely (which would
|
|
# otherwise drag in reqwest, url, idna, and the full ICU/unicode data
|
|
# tables transitively just to ship spans over OTLP) — ledger-core only
|
|
# ever exports traces over gRPC to the local otel-collector
|
|
# (infra/otel-collector), so the tonic transport is all that's needed.
|
|
opentelemetry-otlp = { version = "0.33.1", default-features = false, features = ["trace", "grpc-tonic"] }
|
|
tracing-opentelemetry = "0.34.0"
|
|
tonic-tracing-opentelemetry = "0.42.1"
|
|
# Needed directly (not just transitively via tonic/tonic-tracing-opentelemetry)
|
|
# for src/telemetry.rs's TracedService, which implements tower::{Layer,Service}
|
|
# and references http::{Request,Response} by name.
|
|
http = "1"
|
|
tower = "0.4"
|
|
# Rust counterpart of pkg/metrics's prometheus/client_golang choice on
|
|
# the Go side (docs/SLO.md's "ledger-core" section names this crate
|
|
# directly). default-features = false skips the optional "protobuf"
|
|
# exposition format — Prometheus's text format (TextEncoder, always
|
|
# available) is all services/ledger-core/src/metrics.rs uses.
|
|
prometheus = { version = "0.13", default-features = false }
|
|
# AES-256-GCM envelope encryption for src/wal_crypto.rs (docs/
|
|
# THREAT-MODEL.md's "Known gaps" #6: the WAL and SQLite index are
|
|
# fully plaintext on local disk). Pure Rust (no OpenSSL/libsodium
|
|
# linking), from the audited RustCrypto project — the same family
|
|
# already in this dependency tree transitively via rustls (see
|
|
# tonic's "tls" feature above).
|
|
aes-gcm = "0.10"
|
|
base64 = "0.22"
|
|
|
|
[build-dependencies]
|
|
cc = "1"
|
|
tonic-build = "0.12"
|
|
|
|
[dev-dependencies]
|
|
tempfile = "3"
|
|
tokio = { version = "1", features = ["full", "test-util"] }
|
|
proptest = "1"
|
|
tonic-health = "0.12"
|
|
rcgen = "0.13"
|
|
tokio-stream = "0.1"
|