Repository navigation
Breaking changes
On the wire, for agents and the programs that read agcli output:
-
A secret in argv is no longer echoed. The
commandfield, and the error
text that quotes an argument, mask the value of any flag the command's
usage does not declare, in--flag=value,--flag value,-x=valueand
-x value:app run --passphrase=hunter2reports
app run --passphrase=<redacted>. ThePARSE_ERRORfor a malformed token
such as-abc=5quotes it as-abc=<redacted>, a line that fails to
parse masks every token that is not a flag name or a command name, and the
flag values in a raw command's tokens, and before its name, are masked.
A token right after a masked bare flag is masked whole, even when it
starts with a dash, and the flags it would set are left out of
UNKNOWN_FLAGandPARSE_ERRORtext. The type's own parse error is
left out ofarg_parseandflag_parseerrors for a masked value, and
error text that quotes a hook-rewritten argument shows<redacted>. A line that used to
rerun as printed no longer does when it carried such a value: declare the
flag in the usage (--passphrase=<value>) to keep its value incommand.In Rust,
Invocation::command_linereturns the masked line inside a
handler, as the envelope shows it;Invocation::parsestill returns it
verbatim. -
A command's name is never a flag's value. A bare flag (no
=) takes
the next token as its value only when that token does not name a
command where a command name can go; otherwise the flag is given no
value and the token is the command. A flag misplaced before a command's
name now gets the error that names it:app --max grep patis
INVALID_FLAG"flag --max does not reach raw commandgrep",
app --bogus grep patandcalc --bogus add 1 2areUNKNOWN_FLAG, and
ops --lines logs apprunslogs, which answers that--lineswas given
no value. All of these used to beUNKNOWN_COMMANDfor the next word.
Write--flag=valueto pass a value spelled like a command.app --name status status, which set--nametostatus, becomes
app --name=status status. Underwithout_reserved_flags(),
app --profile grep grep patnow hands rawgrep["grep", "pat"],
not["pat"].
Added
Command::secret(name)masks a declared flag or positional as
<redacted>in thecommandfield and every error's text. The handler
still reads the real value.nameis how the usage spells it, without
dashes or angle brackets.AgentCli::redact_arg(hook)takesFn(&str) -> Option<String>, applied
to each argv element before an envelope echoes it, for patterns only the
app knows, such asfield=valueassignments. See "Secrets in argv" in the
README.audit()reportsUNDECLARED_SECRET, aCommand::secretname that no
command on its path declares (a flag counts from a parent's usage or a
subcommand's), andSECRET_ON_RAW_COMMAND, a secret marked on a raw
command, whose tokens are never parsed. Both are errors, since neither masks
anything.SECRET_AFTER_OPTIONALwarns about a secret positional after
an optional one: when the optional is left out, every positional from the
first optional on is masked.