Skip to content

Latest commit

 

History

History
399 lines (316 loc) · 14.1 KB

File metadata and controls

399 lines (316 loc) · 14.1 KB

Glossary of Soroban & Stellar Security Terms

Definitions for the Soroban/Stellar and security concepts used throughout the Sanctifier docs. Every term has a stable anchor so findings, reports, and other pages can deep-link to it — e.g. glossary.md#require_auth or glossary.md#oog-out-of-gas.

This page is part of the core documentation set. Finding codes referenced below are listed in Finding Codes, and each has a full write-up (vulnerable example + fix) in the Detector Catalog.

Sections: Platform · Authorization · Storage & ledger · Resources & cost · Code-safety · Contract lifecycle · Verification · Tooling


Platform

Stellar

An open-source, public blockchain network for payments and asset issuance. Soroban is Stellar's smart-contract platform. See stellar.org.

Soroban

Stellar's smart-contract platform. Contracts are written in Rust, compiled to WASM, and executed by the Soroban host. See soroban.stellar.org.

WASM

WebAssembly — the bytecode format Soroban contracts compile to (target wasm32-unknown-unknown). Sanctifier analyzes Rust source, not compiled WASM; problems that only surface when building for wasm32 (e.g. a non-no_std dependency) are build issues, not Sanctifier findings.

Smart contract

Program deployed on-chain whose code deterministically governs state transitions. On Soroban, a Rust module annotated with #[contract] / #[contractimpl].

Host function / Env

Capabilities the Soroban host exposes to a contract (storage, crypto, auth, cross-contract calls), accessed through the soroban_sdk::Env handle passed to contract functions.

no_std

A Rust crate that does not depend on the standard library. Soroban contracts are no_std; a dependency that requires std will fail to build for wasm32.


Authorization

Authentication

Establishing who is making a call (which address). Distinct from authorization.

Authorization

Deciding whether an authenticated caller is allowed to perform an action. In Soroban this is enforced with require_auth.

require_auth

Soroban host call (Address::require_auth / require_auth_for_args) that asserts the given address authorized the current invocation. Omitting it on a state-mutating function is an authorization gap (S001).

Authorization gap (auth gap)

A privileged or state-mutating function that changes state without calling require_auth, allowing unauthorized callers to act. Detected as S001.

Privileged / admin function

A function whose effects (minting, upgrading, changing config) should be restricted to a specific admin address. Must be guarded by require_auth.

Address

Soroban Address — identifies an account or a contract. Used as the subject of require_auth and as the holder in token operations.

Hardcoded address

An admin address or secret literal embedded directly in source instead of being configured/stored. Brittle and a security risk; detected as S012.


Storage & ledger

Ledger

The replicated state of the network at a point in time. Contract data lives in ledger entries.

Ledger entry

A single unit of stored on-chain state (a key/value record a contract reads and writes). Subject to a maximum size.

Ledger entry size limit

The maximum byte size of a single ledger entry. Sanctifier models this as ledger_limit (default 64000) and flags state approaching or exceeding it (S004).

Storage durability

Soroban classifies stored data by lifetime: Instance, Persistent, and Temporary. Choosing the wrong durability wastes rent or risks unexpected archival.

Instance storage

Storage tied to the contract instance itself; loaded with the contract. Best for small, always-needed config.

Persistent storage

Long-lived per-key storage that survives across invocations and must be kept alive via TTL bumps. Best for user balances and durable records.

Temporary storage

Short-lived storage that can be archived/expired cheaply. Best for ephemeral data (nonces, short-term caches) to reduce cost and OOG risk.

State archival / TTL

Soroban reclaims entries whose time-to-live expires; contracts "bump" the TTL to keep persistent data live. Forgetting to bump can make data inaccessible.

Storage key collision

Two logically distinct pieces of state mapping to the same storage key, so one overwrites the other. Detected as S005.


Resources & cost

Resource metering / budget

Soroban meters CPU instructions and memory per invocation against a budget. Exceeding the budget aborts the call (OOG).

OOG (Out of Gas)

An invocation that exhausts its resource/CPU budget and aborts. Driven by oversized state, unbounded loops, or expensive operations. Sanctifier's ledger-size and resource heuristics (S004) surface the common causes.

Instruction count

The metered number of CPU instructions an invocation executes; a primary component of the resource budget.

Footprint

The set of ledger entries an invocation declares it will read/write. An accurate, minimal footprint keeps cost and risk down.


Code-safety

Panic

An unrecoverable Rust abort (panic!, or via unwrap/expect). In a contract this traps the invocation. Detected as S002; prefer returning a Result/contract error.

unwrap / expect

Option/Result methods that panic on the absent/error case. Common source of avoidable contract aborts.

Unhandled Result

A function call returning a Result whose value is ignored, so an error path is silently dropped. Detected as S009.

Arithmetic overflow / underflow

An integer operation that exceeds the type's range, wrapping or panicking. Unchecked arithmetic in value/balance math is dangerous; detected as S003.

checked_add / saturating_add

Safe arithmetic methods: checked_* returns None on overflow (handle explicitly); saturating_* clamps to the type bound. Preferred over raw +/-/* in contract math.

Edge-amount validation

Guards on token operations such as amount > 0 and from != to. Missing these allows no-op or self-transfer abuse; detected as S013.

Reentrancy

A vulnerability where a contract is re-entered (often via a cross-contract call) before its first invocation finishes, observing inconsistent intermediate state. Mitigated with checks-effects-interactions ordering and runtime guards.

unsafe

Rust code that opts out of compiler safety guarantees. Rare and discouraged in contracts; flagged generically as S006 and a common target for a custom rule.

Dead code

Unreachable code or always-true/false guards (e.g. detectable via constant folding). Detected as S015; often signals a logic mistake.

Error code collision

Duplicate or inconsistent discriminants in a #[contracterror] enum, so distinct errors are indistinguishable on-chain. Detected as S016.

Event

A log record a contract publishes (topics + data) for off-chain consumers. Inconsistent topic counts or wasteful patterns are detected as S008.


Contract lifecycle

Contract upgrade

Replacing a deployed contract's WASM (e.g. via update_current_contract_wasm). Powerful and risky; upgrade/admin mechanisms are analyzed for S010.

update_current_contract_wasm

The Soroban host call that swaps a contract's code. Must be tightly authorized and paired with safe post-upgrade initialization.

Initialization

A one-time init step that sets required state (admin, config). An upgrade mechanism without an init path is an upgrade risk (S010).

Token contract

A contract implementing fungible-token semantics (balances, transfers, mint, burn). The subject of Sanctifier's built-in invariants.

Mint / Burn

Creating (mint) or destroying (burn) token units. Must be authorized and conserve supply; unauthorized mint is a classic exploit (see no_unauthorized_mint).

Cross-contract call

One contract invoking another (env.invoke_contract). Edges are extracted by sanctifier callgraph; a vector for reentrancy.

Call graph

A directed graph of cross-contract calls, emitted as Graphviz DOT by callgraph, used to reason about trust boundaries.


Verification

Invariant

A property that must always hold (e.g. total supply is conserved). Declared with #[sanctify::invariant(EXPR)] and checked by verify; a refuted invariant is S011.

Formal verification

Mathematically proving (or refuting) that code satisfies a specification, rather than testing samples. Sanctifier uses SMT and optionally Kani.

SMT

Satisfiability Modulo Theories — the technique behind automated proof of arithmetic/logic properties. Sanctifier dispatches pure-function invariants to the Z3 SMT solver.

Z3

The SMT solver Sanctifier links for verify and prove. Requires the Z3 C headers at build time — see the FAQ.

Kani

A Rust model checker for deeper, function-call-level proofs. Complex invariants are reported as KANI ↗ with a reminder to run cargo kani.

Proof certificate

An on-disk artifact recording the result of an SMT proof, written by prove (skip with --no-save).

supply_conserved

Built-in token invariant: total supply is unchanged by transfers. Provable via sanctifier prove --invariant supply_conserved.

balance_non_negative

Built-in token invariant: no account balance can become negative.

no_unauthorized_mint

Built-in token invariant: tokens cannot be minted without proper authorization.

Verifying key

The public parameter a zero-knowledge proof (e.g. Groth16) is checked against — derived from the circuit during trusted setup. If it isn't pinned (hardcoded, hash-checked, or gated behind admin require_auth()), whoever controls it controls what "a valid proof" means; see vk_provenance.


Tooling

Static analysis

Analyzing source code without executing it. Sanctifier's analyze parses Rust to find security-relevant patterns.

Finding code

A stable identifier (S001S016) for a class of finding, shared across CLI and JSON output. See Finding Codes.

Severity

The seriousness of a finding. Sanctifier groups results into critical and high for exit-code purposes; custom rules accept info, warning, or error.

False positive

A reported finding that is not actually a problem. Static analysis is conservative and produces some; handling strategies are in the FAQ.

False negative

A real problem the analyzer did not report. Why Sanctifier complements, but does not replace, audits and tests.

Golden snapshot

A reviewed reference output (insta snapshot) each detector is tested against, so its findings cannot change unnoticed. See tooling/sanctifier-core/tests.

Custom rule

A user-defined regex check configured under [[custom_rules]]; matches are reported as S007.


See also