Skip to content

v0.19.0

Latest

Choose a tag to compare

@github-actions github-actions released this 29 Oct 18:49
· 2 commits to master since this release

Breaking changes

On the wire, for agents and the programs that read agcli output:

  • A secret in argv is no longer echoed. The command field, 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=value and
    -x value: app run --passphrase=hunter2 reports
    app run --passphrase=<redacted>. The PARSE_ERROR for a malformed token
    such as -abc=5 quotes 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_FLAG and PARSE_ERROR text. The type's own parse error is
    left out of arg_parse and flag_parse errors 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 in command.

    In Rust, Invocation::command_line returns the masked line inside a
    handler, as the envelope shows it; Invocation::parse still 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 pat is
    INVALID_FLAG "flag --max does not reach raw command grep",
    app --bogus grep pat and calc --bogus add 1 2 are UNKNOWN_FLAG, and
    ops --lines logs app runs logs, which answers that --lines was given
    no value. All of these used to be UNKNOWN_COMMAND for the next word.
    Write --flag=value to pass a value spelled like a command.

    app --name status status, which set --name to status, becomes
    app --name=status status. Under without_reserved_flags(),
    app --profile grep grep pat now hands raw grep ["grep", "pat"],
    not ["pat"].

Added

  • Command::secret(name) masks a declared flag or positional as
    <redacted> in the command field and every error's text. The handler
    still reads the real value. name is how the usage spells it, without
    dashes or angle brackets.
  • AgentCli::redact_arg(hook) takes Fn(&str) -> Option<String>, applied
    to each argv element before an envelope echoes it, for patterns only the
    app knows, such as field=value assignments. See "Secrets in argv" in the
    README.
  • audit() reports UNDECLARED_SECRET, a Command::secret name that no
    command on its path declares (a flag counts from a parent's usage or a
    subcommand's), and SECRET_ON_RAW_COMMAND, a secret marked on a raw
    command, whose tokens are never parsed. Both are errors, since neither masks
    anything. SECRET_AFTER_OPTIONAL warns about a secret positional after
    an optional one: when the optional is left out, every positional from the
    first optional on is masked.