Skip to main content

AttestAction

Enum AttestAction 

Source
pub enum AttestAction {
    Scan {
        path: Option<PathBuf>,
        strict: bool,
        extra_paths: Vec<PathBuf>,
        format: AttestScanFormat,
        output: Option<PathBuf>,
    },
    Run {
        contract: Option<PathBuf>,
        emit_run_evidence: Option<PathBuf>,
        audit_trail: Option<PathBuf>,
        allow_command_override: bool,
        sign_run_evidence: bool,
        no_sign: bool,
        command: Vec<String>,
    },
    Verify {
        evidence: PathBuf,
        pubkey: Option<String>,
        require_pinned: bool,
    },
    Key {
        action: AttestKeyAction,
    },
    Trust {
        action: AttestTrustAction,
    },
}
Expand description

Attestation subcommands — Phases 3 and 4 of the algol→tsafe migration.

  • scan (Phase 3) — secret + env-authority scanner.
  • run (Phase 4) — env-injection enforcement harness; emits RunEvidence + CloudEvents audit trail.

Variants§

§

Scan

Scan a repo for committed secrets and env-authority signals.

Defaults to scanning the current directory. The scanner is the Phase 3 port of the algol Phase 2.1 scanner; see crate docs for the full provenance trail.

Scanner P/R on synthetic N=100 corpus: 1.000 / 1.000. Real-world rates may differ. See ecosystem-catalog/portfolio-algol-tsafe-phase2-1-precision-recovery-2026-05-21.md for the verdict.

Fields

§path: Option<PathBuf>

Repo path to scan (defaults to current directory).

§strict: bool

Exit with code 2 if any secret-class finding is present.

Secret-class kinds: ENV_FILE, HARDCODED_SECRET, PRIVATE_KEY. SECRET_PLACEHOLDER (Phase 2.1 — placeholder/comment context) is NOT counted as a secret finding.

§extra_paths: Vec<PathBuf>

Additional paths to scan (repeatable). Findings from all paths are merged into a single report.

§format: AttestScanFormat

Output format.

§output: Option<PathBuf>

Write the report to this file (otherwise printed to stdout).

§

Run

Run a command under env-injection enforcement.

Loads an AttestContract, strips the parent env, injects declared variables from the configured sources, spawns the command, and emits a RunEvidence artifact + CloudEvents audit-trail entry.

Phase 4 wire formats: tsafe.run.v1 RunEvidence, tsafe.audit_event.v1 audit events, BLAKE3 fingerprints. Legacy algol.* schemas + SHA-256 hashes are accepted on parse during the v1.x compat window.

Fields

§contract: Option<PathBuf>

Path to the AttestContract to enforce. Defaults to tsafe.contract.yaml in the current directory.

§emit_run_evidence: Option<PathBuf>

Path to write the RunEvidence artifact. Defaults to tsafe-run.json in the current directory.

§audit_trail: Option<PathBuf>

Path to the audit-trail NDJSON log. Each line is a CloudEvents envelope. Defaults to tsafe-audit-events.ndjson.

§allow_command_override: bool

Allow the supplied command to differ from the contract’s command field. Disabled by default; useful only for testing.

§sign_run_evidence: bool

Phase 5: sign the emitted RunEvidence with the per-profile Ed25519 keyring entry. Default is ON — if no key is provisioned, one is auto-generated on first use with a stderr warning (tsafe attest key generate is the explicit form). Use --no-sign to opt out.

§no_sign: bool

Phase 5: explicitly disable Ed25519 signing of the emitted RunEvidence. Overrides the default-on --sign-run-evidence behaviour.

§command: Vec<String>

Command to execute under enforcement. Pass after --.

§

Verify

Verify the Ed25519 signature on a RunEvidence artifact.

Phase 5 (this version) emits artifacts with a signature field carrying an Ed25519 signature over the canonical encoding of every other field. verify re-derives the canonical bytes, prepends the tsafe.run_evidence.v1 domain tag, and checks the signature.

Without --pubkey, the embedded pubkey on the artifact is used (TOFU); a stderr warning is emitted reminding the operator to pin the pubkey out of band. With --pubkey <base64url>, the supplied key takes precedence.

Exit codes:

  • 0 — signature is valid
  • 5 — artifact has no signature field
  • 6 — signature verification failed (tampered or wrong key)
  • 7--require-pinned: signer is not a pinned trusted identity
  • other — internal error

Fields

§evidence: PathBuf

Path to the RunEvidence JSON artifact to verify.

§pubkey: Option<String>

Operator-supplied verifying key (base64url-encoded, no padding, 32 bytes after decoding). If omitted, the pubkey embedded in the artifact is used (TOFU; see honest disclosure on --help).

§require_pinned: bool

Fail closed (exit code 7) unless the signing key matches an identity pinned in the trust store (tsafe attest trust add). This converts TOFU verification into identity-anchored verification: the cryptographic check still runs, AND the signer must be a key the operator has explicitly trusted. When combined with --pubkey, both must agree.

§

Key

Manage the tsafe-attest Ed25519 signing key for a profile.

The key lives in the OS credential store under the per-profile tsafe-attest-signing-key account name. tsafe attest run signs emitted RunEvidence artifacts with this key by default; tsafe attest verify can use the embedded pubkey or an operator-supplied one.

Fields

§

Trust

Manage the pinned-pubkey trust store used by tsafe attest verify --require-pinned.

The trust store binds operator-chosen identity names to pinned Ed25519 public keys, closing the Phase 5 TOFU gap: once a producer’s pubkey is pinned out of band, verify --require-pinned will fail closed for any artifact NOT signed by a pinned identity.

The store lives at <config-root>/trust-store.json (honoring TSAFE_VAULT_DIR). It holds only public keys — no secrets.

Fields

Trait Implementations§

Source§

impl FromArgMatches for AttestAction

Source§

fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>

Instantiate Self from ArgMatches, parsing the arguments as needed. Read more
Source§

fn from_arg_matches_mut( __clap_arg_matches: &mut ArgMatches, ) -> Result<Self, Error>

Instantiate Self from ArgMatches, parsing the arguments as needed. Read more
Source§

fn update_from_arg_matches( &mut self, __clap_arg_matches: &ArgMatches, ) -> Result<(), Error>

Assign values from ArgMatches to self.
Source§

fn update_from_arg_matches_mut<'b>( &mut self, __clap_arg_matches: &mut ArgMatches, ) -> Result<(), Error>

Assign values from ArgMatches to self.
Source§

impl Subcommand for AttestAction

Source§

fn augment_subcommands<'b>(__clap_app: Command) -> Command

Append to Command so it can instantiate Self via FromArgMatches::from_arg_matches_mut Read more
Source§

fn augment_subcommands_for_update<'b>(__clap_app: Command) -> Command

Append to Command so it can instantiate self via FromArgMatches::update_from_arg_matches_mut Read more
Source§

fn has_subcommand(__clap_name: &str) -> bool

Test whether Self can parse a specific subcommand

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more