eb-local.secrets

module eb-local.secrets  src/secrets.zig[source][autodoc]

Secrets for a build: each names the variable eb receives and where its value comes from. A build reads the ones it gets (config.buildSecrets), after every other check; config --check and doctor read each one and say only whether it can be read. Values go only into eb’s environment and are never printed. A failed read reports why without the value. After the build, logs written during it are scanned and every occurrence of a value is replaced.

Types

pub const Resolved = struct[source][autodoc]

A secret’s value, read for one build: the variable eb receives, and what it is set to.

name: []const u8[source]
value: []const u8[source]
pub const Failure = struct[source][autodoc]

Why a secret could not be read, filled in when error.Unavailable is returned. It names the secret and its source, never a value.

message: []const u8 = ""[source]
pub const Nimvault = struct[source][autodoc]

Which nimvault runs and which vault it reads.

program: []const u8 = ""[source]

An absolute path; empty means the first nimvault on PATH.

vault: []const u8 = ""[source]

Passed as –vault; ~/ is HOME. Empty leaves nimvault to find the vault from NIMVAULT_VAULT_REPO or the current directory.

pub const Failed = struct[source][autodoc]

A log that could not be checked or rewritten, and why.

path: []const u8[source]
why: []const u8[source]
pub const RedactReport = struct[source][autodoc]

What redactTree did: how many logs it rewrote without the values, and the logs it left as they were, by reason.

files: usize = 0[source]
too_large: std.ArrayList([]const u8) = .empty[source]
too_deep: std.ArrayList([]const u8) = .empty[source]
unchecked: std.ArrayList(Failed) = .empty[source]

Logs that could not be read, or decompressed, to check them.

unchanged: std.ArrayList(Failed) = .empty[source]

Logs that hold a value and could not be rewritten without it.

pub const Tools = struct[source][autodoc]

Where the programs for compressed logs are found, and their environment.

path: []const u8[source]
envp: proc.Envp[source]
pub const Filter = enum[source][autodoc]

Which files below a directory redactTree checks.

all[source]

Every regular file.

easybuild_dirs[source]

Only files in a directory named “easybuild”: the logs and recipes an installation keeps, not the installed software itself.

Error sets

pub const Error = error{Unavailable} || Allocator.Error[source][autodoc]

error.Unavailable when a secret’s source cannot give its value, with the reason in the Failure.

Functions

pub fn resolve( a: Allocator, secrets: []const config.Secret, env: *const std.process.Environ.Map, envp: proc.Envp, nv: Nimvault, f: *Failure) Error![]Resolved[source][autodoc]

The value of every secret, in order.

pub fn placeholder(a: Allocator, name: []const u8) Allocator.Error![]const u8[source][autodoc]

What stands in for a value in a redacted log.

pub fn redactText(a: Allocator, bytes: []const u8, values: []const Resolved) Allocator.Error!?[]u8[source][autodoc]

Replace every value, in each of its forms, in bytes; null when none occurs. The longest form wins where several start at the same byte, so a shorter secret that is a prefix of a longer one does not leave the rest behind. Percent-encoding matches either hex case.

pub fn redactTree(a: Allocator, dir_path: []const u8, since: i64, values: []const Resolved, filter: Filter, tools: Tools, report: *RedactReport) (fsx.Error || Allocator.Error)!void[source][autodoc]

Redact regular files below dir (never through a symbolic link) modified at or after since (seconds); compressed ones through the program their suffix names, from tools.

Constants

pub const value_limit = 64 * 1024[source][autodoc]

Largest secret accepted from any source.

pub const nimvault_timeout_ms = 30_000[source][autodoc]

How long nimvault may take (a GPG agent may ask for a passphrase).

pub const min_redacted_len = 4[source][autodoc]

Shorter values would match ordinary text everywhere; they are not redacted, and a build that has one is told so.

pub const log_limit: usize = 1 << 30[source][autodoc]

Largest log rewritten; a larger one is reported, not rewritten.

pub const max_depth = 16[source][autodoc]

Deepest directory searched; anything deeper is reported.

pub const codec_timeout_ms = 30 * 60_000[source][autodoc]

How long a decompressor or compressor may take over one log.