Rules / TAU-A001
No ambient authority
#[expect] + reasonWhy
Filesystem, network, environment, clock, randomness and process access must arrive as parameters (capabilities), so a signature shows everything a function can touch and tests can substitute them.
Fix
Take a capability parameter (for example a &cap_std::fs::Dir from Authority::dir, &dyn tauten::cap::Clock, or &tauten::cap::Env) and let an edge crate construct it.
What it checks
Banned in kernel, core (ambient authority through cap-std), 7 methods: cap_std::ambient_authority, ambient_authority::ambient_authority, cap_std::fs::Dir::open_ambient_dir, cap_std::fs::Dir::create_ambient_dir_all, cap_std::fs::File::open_ambient, cap_std::fs::File::create_ambient, cap_std::fs::File::open_ambient_with
Banned in kernel, core (ambient filesystem access), 45 methods
std::fs::read, std::fs::read_to_string, std::fs::write, std::fs::read_dir, std::fs::create_dir, std::fs::create_dir_all, std::fs::remove_file, std::fs::remove_dir, std::fs::remove_dir_all, std::fs::rename, std::fs::copy, std::fs::metadata, std::fs::symlink_metadata, std::fs::canonicalize, std::fs::hard_link, std::fs::set_permissions, std::fs::read_link, std::fs::exists, std::fs::File::open, std::fs::File::create, std::fs::File::create_new, std::fs::File::options, std::fs::OpenOptions::new, std::path::Path::exists, std::path::Path::try_exists, std::path::Path::is_file, std::path::Path::is_dir, std::path::Path::is_symlink, std::path::Path::metadata, std::path::Path::symlink_metadata, std::path::Path::read_dir, std::path::Path::canonicalize, std::path::Path::read_link, tokio::fs::read, tokio::fs::read_to_string, tokio::fs::write, tokio::fs::read_dir, tokio::fs::create_dir_all, tokio::fs::remove_file, tokio::fs::remove_dir_all, tokio::fs::rename, tokio::fs::copy, tokio::fs::metadata, tokio::fs::File::open, tokio::fs::File::create
Banned in kernel, core (ambient environment or process state), 16 methods
std::env::var, std::env::var_os, std::env::vars, std::env::vars_os, std::env::args, std::env::args_os, std::env::current_dir, std::env::set_current_dir, std::env::set_var, std::env::remove_var, std::env::temp_dir, std::env::home_dir, std::env::current_exe, std::process::Command::new, std::process::id, tokio::process::Command::new
Banned in kernel, core (ambient clock), 11 methods: std::time::SystemTime::now, std::time::Instant::now, std::thread::sleep, tokio::time::Instant::now, tokio::time::sleep, chrono::Utc::now, chrono::Local::now, time::OffsetDateTime::now_utc, time::OffsetDateTime::now_local, jiff::Timestamp::now, jiff::Zoned::now
Banned in kernel, core (ambient randomness), 7 methods: rand::thread_rng, rand::rng, rand::random, getrandom::getrandom, getrandom::fill, uuid::Uuid::new_v4, uuid::Uuid::now_v7
Banned in kernel, core (ambient network or standard streams), 37 methods
std::net::TcpStream::connect, std::net::TcpStream::connect_timeout, std::net::TcpListener::bind, std::net::UdpSocket::bind, std::net::ToSocketAddrs::to_socket_addrs, std::io::stdin, std::io::stdout, std::io::stderr, tokio::net::TcpStream::connect, tokio::net::TcpListener::bind, tokio::net::UdpSocket::bind, tokio::io::stdin, tokio::io::stdout, tokio::io::stderr, reqwest::get, reqwest::Client::new, reqwest::blocking::get, reqwest::blocking::Client::new, ureq::get, ureq::head, ureq::patch, ureq::post, ureq::put, ureq::delete, ureq::options, ureq::connect, ureq::trace, ureq::request, ureq::request_url, ureq::run, ureq::agent, ureq::builder, ureq::Agent::new, ureq::AgentBuilder::new, ureq::Agent::new_with_defaults, ureq::Agent::new_with_config, ureq::config::Config::new_agent
Seen in fixtures
rej-ambient-clock/src/lib.rs core
//! Reads the clock without a capability. /// Current time.#[must_use]pub fn now() -> std::time::SystemTime { std::time::SystemTime::now()}$ cargo tauten check
error[TAU-A001]: use of a disallowed method `std::time::SystemTime::now` --> rej-ambient-clock/src/lib.rs:6:5 (core crate `rej-ambient-clock`) = rule: No ambient authority (decided by Clippy) = fix: Take a capability parameter (for example a `&cap_std::fs::Dir` from `Authority::dir`, `&dyn tauten::cap::Clock`, or `&tauten::cap::Env`) and let an edge crate construct it.rej-ambient-clock (core) expects TAU-A001. Output captured at 0200db3.rej-ambient-http/src/lib.rs core
//! Opens HTTP without a capability. /// Starts a request to a fixed address.#[must_use]pub fn fetch() -> ureq::Request { ureq::get("http://example.invalid/")} /// Builds an agent with ambient network access.#[must_use]pub fn agent() -> ureq::Agent { ureq::Agent::new_with_defaults()}$ cargo tauten check
error[TAU-A001]: use of a disallowed method `ureq::get` --> rej-ambient-http/src/lib.rs:6:5 (core crate `rej-ambient-http`) = rule: No ambient authority (decided by Clippy) = fix: Take a capability parameter (for example a `&cap_std::fs::Dir` from `Authority::dir`, `&dyn tauten::cap::Clock`, or `&tauten::cap::Env`) and let an edge crate construct it. error[TAU-A001]: use of a disallowed method `ureq::Agent::new_with_defaults` --> rej-ambient-http/src/lib.rs:12:5 (core crate `rej-ambient-http`) = rule: No ambient authority (decided by Clippy) = fix: Take a capability parameter (for example a `&cap_std::fs::Dir` from `Authority::dir`, `&dyn tauten::cap::Clock`, or `&tauten::cap::Env`) and let an edge crate construct it.rej-ambient-http (core) expects TAU-A001. Output captured at 0200db3.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-A001]: use of a disallowed method `cap_std::fs::Dir::open_ambient_dir` --> rej-authority-alias/src/lib.rs:17:5 (core crate `rej-authority-alias`) = rule: No ambient authority (decided by Clippy) = fix: Take a capability parameter (for example a `&cap_std::fs::Dir` from `Authority::dir`, `&dyn tauten::cap::Clock`, or `&tauten::cap::Env`) and let an edge crate construct it. error[TAU-A001]: use of a disallowed method `ambient_authority::ambient_authority` --> rej-authority-alias/src/lib.rs:17:45 (core crate `rej-authority-alias`) = rule: No ambient authority (decided by Clippy) = fix: Take a capability parameter (for example a `&cap_std::fs::Dir` from `Authority::dir`, `&dyn tauten::cap::Clock`, or `&tauten::cap::Env`) and let an edge crate construct it.rej-authority-alias (core) expects TAU-A001, TAU-A002. Output captured at 0200db3.rej-hidden-authority/src/lib.rs core
//! Reads the filesystem without a capability. /// Load configuration.////// # Errors/// IO errors.pub fn load() -> std::io::Result<String> { std::fs::read_to_string("config.toml")}$ cargo tauten check
error[TAU-A001]: use of a disallowed method `std::fs::read_to_string` --> rej-hidden-authority/src/lib.rs:8:5 (core crate `rej-hidden-authority`) = rule: No ambient authority (decided by Clippy) = fix: Take a capability parameter (for example a `&cap_std::fs::Dir` from `Authority::dir`, `&dyn tauten::cap::Clock`, or `&tauten::cap::Env`) and let an edge crate construct it.rej-hidden-authority (core) expects TAU-A001. Output captured at 0200db3.In the terminal
cargo tauten explain TAU-A001$ cargo tauten explain TAU-A001
TAU-A001: No ambient authority Why: Filesystem, network, environment, clock, randomness and process access must arrive as parameters (capabilities), so a signature shows everything a function can touch and tests can substitute them. Fix: Take a capability parameter (for example a `&cap_std::fs::Dir` from `Authority::dir`, `&dyn tauten::cap::Clock`, or `&tauten::cap::Env`) and let an edge crate construct it. Decided by: ClippyDecides: No call to a banned ambient-authority API (filesystem, network, environment, clock, randomness, process) 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: noExceptions allowed: with #[expect(.., reason)] kernel deny core deny edge -Banned (ambient authority through cap-std): cap_std::ambient_authority, ambient_authority::ambient_authority, cap_std::fs::Dir::open_ambient_dir, cap_std::fs::Dir::create_ambient_dir_all, cap_std::fs::File::open_ambient, cap_std::fs::File::create_ambient, cap_std::fs::File::open_ambient_withBanned (ambient filesystem access): std::fs::read, std::fs::read_to_string, std::fs::write, std::fs::read_dir, std::fs::create_dir, std::fs::create_dir_all, std::fs::remove_file, std::fs::remove_dir, std::fs::remove_dir_all, std::fs::rename, std::fs::copy, std::fs::metadata, std::fs::symlink_metadata, std::fs::canonicalize, std::fs::hard_link, std::fs::set_permissions, std::fs::read_link, std::fs::exists, std::fs::File::open, std::fs::File::create, std::fs::File::create_new, std::fs::File::options, std::fs::OpenOptions::new, std::path::Path::exists, std::path::Path::try_exists, std::path::Path::is_file, std::path::Path::is_dir, std::path::Path::is_symlink, std::path::Path::metadata, std::path::Path::symlink_metadata, std::path::Path::read_dir, std::path::Path::canonicalize, std::path::Path::read_link, tokio::fs::read, tokio::fs::read_to_string, tokio::fs::write, tokio::fs::read_dir, tokio::fs::create_dir_all, tokio::fs::remove_file, tokio::fs::remove_dir_all, tokio::fs::rename, tokio::fs::copy, tokio::fs::metadata, tokio::fs::File::open, tokio::fs::File::createBanned (ambient environment or process state): std::env::var, std::env::var_os, std::env::vars, std::env::vars_os, std::env::args, std::env::args_os, std::env::current_dir, std::env::set_current_dir, std::env::set_var, std::env::remove_var, std::env::temp_dir, std::env::home_dir, std::env::current_exe, std::process::Command::new, std::process::id, tokio::process::Command::newBanned (ambient clock): std::time::SystemTime::now, std::time::Instant::now, std::thread::sleep, tokio::time::Instant::now, tokio::time::sleep, chrono::Utc::now, chrono::Local::now, time::OffsetDateTime::now_utc, time::OffsetDateTime::now_local, jiff::Timestamp::now, jiff::Zoned::nowBanned (ambient randomness): rand::thread_rng, rand::rng, rand::random, getrandom::getrandom, getrandom::fill, uuid::Uuid::new_v4, uuid::Uuid::now_v7Banned (ambient network or standard streams): std::net::TcpStream::connect, std::net::TcpStream::connect_timeout, std::net::TcpListener::bind, std::net::UdpSocket::bind, std::net::ToSocketAddrs::to_socket_addrs, std::io::stdin, std::io::stdout, std::io::stderr, tokio::net::TcpStream::connect, tokio::net::TcpListener::bind, tokio::net::UdpSocket::bind, tokio::io::stdin, tokio::io::stdout, tokio::io::stderr, reqwest::get, reqwest::Client::new, reqwest::blocking::get, reqwest::blocking::Client::new, ureq::get, ureq::head, ureq::patch, ureq::post, ureq::put, ureq::delete, ureq::options, ureq::connect, ureq::trace, ureq::request, ureq::request_url, ureq::run, ureq::agent, ureq::builder, ureq::Agent::new, ureq::AgentBuilder::new, ureq::Agent::new_with_defaults, ureq::Agent::new_with_config, ureq::config::Config::new_agent