tools tier

tools-security-ratchet

Source-level security invariant ratchet. Encodes the invariant classes found by the 2026-07 audit (docs/reports/SECURITY-FINDINGS.md) as checks over the tree, with a shrinking baseline of known violations. New violations fail the build; fixing one and re-baselining is the only way the count goes down.

Source-level security invariant ratchet. Encodes the invariant classes found by the 2026-07 audit (docs/reports/SECURITY-FINDINGS.md) as checks over the tree, with a shrinking baseline of known violations. New violations fail the build; fixing one and re-baselining is the only way the count goes down.

Tiertools
Roleunclassified (baselined)
Pathcrates/tools/security-ratchet
Edition2021
Targetstools-security-ratchet, tools_security_ratchet
Public items14 across 0 modules
Tests17

What it is for

Source-level security invariant ratchet.

Every check here encodes an invariant class from the 2026-07 audit (docs/reports/SECURITY-FINDINGS.md). The audit's systemic result was that mechanisms were correct and unguarded — deleting one turned no test red — and that per-instance tests do not generalise: the R19 remediation shipped 16 tests that each asserted on one already-fixed struct, so violation number 17 was invisible.

A ratchet is the answer to that class. It scans the whole tree, compares against a committed baseline of known violations, and fails only on ones the baseline does not contain. Fixing a violation and re-baselining is the only way the count goes down; adding one fails the build.

Capabilities

crate root

Source-level security invariant ratchet.

Item
pub const CANONICAL_TENANT_GUC: & str

Baseline

Source-level security invariant ratchet.

Item
pub struct Baseline
Baseline :: fn load(path : & Path) -> Result <Self>
Baseline :: fn save(& self, path : & Path) -> Result <()>

Check

Source-level security invariant ratchet.

Item
pub enum Check
Check :: fn all() -> & 'static Check
Check :: fn remedy(& self) -> & 'static str
Check :: fn fmt(& self, f : & mut fmt::Formatter <'_>) -> fmt::Result
fn check(repo_root : & Path, baseline : & Baseline) -> Result <Report>

Finding

Source-level security invariant ratchet.

Item
pub struct Finding
Finding :: fn key(& self) -> String
fn scan(repo_root : & Path) -> Result <Vec <Finding>>

Report

Source-level security invariant ratchet.

Item
pub struct Report
Report :: fn is_clean(& self) -> bool

How to use it

No examples/ target and no doctest in this crate's rustdoc. The tests listed under Verification are the closest executable usage.

Module structure

No public modules: the crate root is its whole surface.

Public surface

`crate root`

ItemWhat it is
pub enum CheckWhich invariant a finding violates.
Check :: fn all() -> & 'static Check
Check :: fn remedy(& self) -> & 'static strOne line on what to do about it, printed with every new violation.
Check :: fn fmt(& self, f : & mut fmt::Formatter <'_>) -> fmt::Result
pub struct FindingOne violation
Finding :: fn key(& self) -> String
pub struct BaselineThe committed set of known-acceptable violations.
Baseline :: fn load(path : & Path) -> Result <Self>
Baseline :: fn save(& self, path : & Path) -> Result <()>
pub struct ReportResult of a scan measured against a baseline.
Report :: fn is_clean(& self) -> bool
pub const CANONICAL_TENANT_GUC: & strSQL: a tenant GUC read under a non-canonical name.
fn scan(repo_root : & Path) -> Result <Vec <Finding>>Scan the tree rooted at repo_root and return every violation found.
fn check(repo_root : & Path, baseline : & Baseline) -> Result <Report>Scan and compare against the baseline.

No pub use re-exports: every item above is declared in this crate.

Boundary

Depends on no other workspace tier.

Shares tier tools with 84 other crates: tools-advisory-reach, tools-archive-guard, tools-artifact-scaffold, tools-ask-ai-core, tools-ask-ais, tools-ask-gemini, tools-book, tools-book-report, … (84 total).

_What this crate deliberately does NOT own is a judgment. No committed registry records one for it, so none is stated here._

Where it sits

Tier (ontology)tools
Architectural role (taxonomy)unclassified (baselined)
Locationcrates/tools/security-ratchet
Vocabulary in force (lexicon)current

Dependencies

Runtime, from outside the workspace.

CrateRequirementFeaturesOptionalOnly on
anyhow^1noalways
regex^1noalways
serde^1derivenoalways
serde_json^1noalways

Development. None.

Build. None.

Depended on by. Nothing in this workspace.

Feature flags

No Cargo features are defined: every capability is unconditional, so no consumer can receive a half-wired crate.

Targets

KindNameSource
bintools-security-ratchet`src/main.rs`
libtools_security_ratchet`src/lib.rs`

Error model

No public error type was detected: no public item declares a type named *Error, and no public signature returns one.

Operational characteristics

PropertyEvidence
async public surfacenone detected
async runtimenone detected
database accessnone detected
network I/Onone detected
unsafe codenone detected
environment variablesyes

No unsafe block, unsafe fn, unsafe impl or unsafe trait was found by the parser anywhere in this crate's source.

Configuration

VariableRead in
CARGO_MANIFEST_DIRsrc/lib.rs

No workspace crate depends on this one.

Verification

KindCount
Unit tests17
Integration tests0
Examples0
Doctests0

Evidence by module. How often each public module is named by something executable.

ModuleTestsExamplesConsumers
crate root700

What the tests establish, by name:

Documentation coverage

MeasureDocumentedTotal
Public items with rustdoc814
Public modules with a //! block00
pie showData
    title Public items with rustdoc
    "Documented" : 8
    "No rustdoc detected" : 6

Metrics

MetricValue
Rust source files2
Source lines1117
Code lines899
Public API items14
Public modules0
Tests17
Examples0
Cargo features0
Direct runtime dependencies4
Workspace reverse dependencies0
pie showData
    title Public API by kind
    "constant" : 1
    "enum" : 1
    "function" : 2
    "method" : 7
    "struct" : 3
pie showData
    title Rust source composition
    "Code" : 899
    "Blank or comment" : 218

Generation

Rendered by tools-corpus corpus readme from repository evidence alone, renderer schema 2, lexicon current. No model, network service or database was consulted. Regenerate with tools-corpus corpus readme --write; verify with --check.

All tools · Manual