Rules / TAU-A002

Authority minted outside the edge

decided by Clippy kernel deny core deny edge –
Applies to tests: yes Exceptions: #[expect] + reason

Why

Capabilities may only be created at startup in edge crates; minting them deeper defeats the point of passing them.

Fix

Accept the capability as a parameter and create it in the edge crate's main.

What it checks

Banned in kernel, core (mints authority; only an edge crate may), 1 method: tauten::cap::Authority::acquire

Seen in fixtures

rej-authority-alias/src/lib.rs core

//! Mints authority in a core crate without writing `Authority::acquire`. use tauten::cap::Authority as Grant; /// Through a function pointer: no call path for a text scan to see.#[must_use]pub fn via_pointer() -> Grant {    let mint: fn() -> Grant = Grant::acquire;    mint()} /// Through cap-std's own escape hatch.////// # Errors/// Returns the IO error from opening the directory.pub fn via_cap_std() -> std::io::Result<cap_std::fs::Dir> {    cap_std::fs::Dir::open_ambient_dir(".", cap_std::ambient_authority())}

$ cargo tauten check

error[TAU-A002]: use of a disallowed method `tauten::cap::Authority::acquire`  --> rej-authority-alias/src/lib.rs:8:31 (core crate `rej-authority-alias`)  = rule: Authority minted outside the edge (decided by Clippy)  = fix: Accept the capability as a parameter and create it in the edge crate's `main`.
Fixture rej-authority-alias (core) expects TAU-A001, TAU-A002. Output captured at 0200db3.

rej-forged-capability/src/lib.rs core

//! Mints authority outside the edge. /// Stand-in for `tauten::cap::Authority`.pub struct Authority; impl Authority {    /// Mint authority.    #[must_use]    pub const fn acquire() -> Self {        Self    }} /// Library code minting its own authority.#[must_use]pub const fn sneaky() -> Authority {    Authority::acquire()}

$ cargo tauten check

error[TAU-A002]: `Authority::acquire` in core crate `rej-forged-capability`  --> rej-forged-capability/src/lib.rs:17:16 (core crate `rej-forged-capability`)  = rule: Authority minted outside the edge (decided by Clippy)  = fix: Accept the capability as a parameter and create it in the edge crate's `main`.
Fixture rej-forged-capability (core) expects TAU-A002. Output captured at 0200db3.

In the terminal

cargo tauten explain TAU-A002

$ cargo tauten explain TAU-A002

TAU-A002: Authority minted outside the edge Why: Capabilities may only be created at startup in edge crates; minting them deeper defeats the point of passing them. Fix: Accept the capability as a parameter and create it in the edge crate's `main`. Decided by: ClippyDecides: No `Authority::acquire` outside the edge.Sees: resolved; complete: yesDoes not see: Code expanded from macros defined in other crates (clippy skips it); code disabled by `cfg`; build scripts. APIs not on the tier's ban list (clippy.toml), including dependency functions that wrap a banned one; foreign code.Applies to tests: yesExceptions allowed: with #[expect(.., reason)]  kernel deny  core deny  edge -Banned (mints authority; only an edge crate may): tauten::cap::Authority::acquire