Expand description
The values srv holds secret (its instance key, an agent’s token, a Vault value it handed to an agent’s process) are
never written into an agent’s transcript, and never served to a paired device from one: a line that carries one is
stored, and shown to a device, with the value replaced by MARK. A value is matched as it is and in its ordinary
spellings (base64, URL-encoded, hex, as JSON holds it: vault::scrub::forms).
The values are registered where srv learns them (a token is minted or loaded, the instance key is made, a Vault value is handed to a process). The registry holds only what can still be used:
registerkeeps a value for the life of the process;holdkeeps a value for an owner, until its expiry, until the owner isreleased (its token revoked, its container removed, its device unpaired) or until the owner holds another value in its place;hold_untilkeeps a value that works until a given time, and keeps it until then even when a renewed one follows it: the value that was replaced still works, so it stays hidden until it expires;hold_keptkeeps a value with no known expiry (a refresh token, an API key) and keeps the values an owner held before it, up toKEPT_PER_OWNER, oldest dropped first;- a batch of registrations (
register_all) costs one rebuild of the matcher, made when a line next needs it.
The registry is bounded and never fails open. A value up to MAX_POOLED_LEN goes into the one pattern, and the
registry holds at most MAX_TOTAL_BYTES of those; a larger value (a certificate bundle, a key file) is held apart
and matched by an exact search, up to MAX_VALUE_LEN each and MAX_LARGE_BYTES in all. Within a budget the
oldest values an owner holds make room first; a value that does not fit is refused, counted and logged. A pattern
that cannot be built is replaced by an exact search over the same values, and if even that is over its limit every
line is read as the mark (MARK) in place of its text. Either state is logged once with the counts and reported
to the hook (set_alert).
Structs§
- Health
- The state of the registry, for a health read.
Constants§
- KEPT_
PER_ OWNER - How many values with no known expiry an owner keeps with
hold_kept. - MARK
- What a withheld value is replaced by.
- MAX_
LARGE_ BYTES - The most the values over
MAX_POOLED_LENhold in all (bytes). Each is kept in every spelling, about 15 times its size, so this bounds what the exact search holds. - MAX_
POOLED_ LEN - The longest value that goes into the one pattern; a longer one is held apart and matched by an exact search.
- MAX_
TOTAL_ BYTES - The most the pattern’s values hold (bytes of values, not of spellings): past it the oldest values an owner holds make room.
- MAX_
TRUSTED_ LIFE_ MS - The longest a value is trusted to keep working (ms from now): an expiry beyond it is not believed, and the value is
held as one with no known expiry (
hold_kept). - MAX_
VALUE_ LEN - The longest value the registry takes (bytes): a longer one is refused.
- MIN_LEN
- Shorter values are not registered: matching them would mangle ordinary text.
- UNTIL_
PER_ OWNER - How many values an owner holds with
hold_untilat once: past it the one that expires first is dropped (the value just held never is), so what one owner is given cannot crowd out the values of the others.
Functions§
- health
- The state of the registry now.
- hold
- Withholds
valueforowner, in place of what the owner held before, untilexpires_at(unix ms;Nonefor no expiry) or until the owner isreleased. Holding the value the owner already holds changes nothing. - hold_
kept - Withholds
valueforownerwith no expiry, until the process ends or the owner isreleased. The values the owner kept before it stay withheld too, up toKEPT_PER_OWNER: past that the oldest is dropped. Keeping the same value again changes nothing. - hold_
until - Withholds
valueforowneruntilexpires_at(unix ms), when it stops working. A renewed value the owner holds next withhold_untildoes not take its place: the value that was replaced still works until its own expiry, so it stays withheld until then. Holding the same value and expiry again changes nothing. - holds
- Whether
textholds a registered value, in any of its spellings: the same matchertextreplaces with. Always true when matching is closed. - in_
place textover each line, in place.- lines
textover transcript bytes (NDJSON lines); bytes that are not UTF-8 are left as they are, except when matching is closed: then every line is the mark.- register
- Registers
valueto be withheld from now on, for the life of the process. A value shorter thanMIN_LENand one already registered change nothing. - register_
all registerfor each ofvalues, under one lock: the matcher is built once for the lot, when a line next needs it.- release
- Stops withholding what
ownerholds: its value no longer works. - release_
all releasefor whatownerholds and what it holds withhold_until.- release_
prefix release_allfor every owner whose name starts withprefix.- set_
alert - Sets what is told when the registry refuses a value or degrades its matching: one line with the counts, never a value. Called outside the registry’s lock, so it may read or write the registry. The first call wins.
- text
textwith every registered value replaced byMARK; the text itself when it holds none. Never the text of a line when matching is closed: then every line is the mark.