NAME

Langertha::Raider::Permissions::ReadOnlyBash - Internal fixed allowlist of read-only bash commands for the auto permission mode

VERSION

version 0.504

SYNOPSIS

# Internal to Langertha-Raider -- no API promise.
my $class = 'Langertha::Raider::Permissions::ReadOnlyBash';
$class->covers('git status && ls -la');     # 1
$class->covers('git status; rm x');         # 0
$class->covers('cat $(which x)');           # 0
$class->covers('ls > f');                   # 0

DESCRIPTION

Internal module. Its interface may change without notice.

The one place that knows which bash commands the auto permission mode (ADR 0021, Nachtrag P2) runs without asking. A command is covered only when every part of it (split as "shell_parts" in Langertha::Raider::Permissions::Rule splits: at &&, ||, ;, |, &, newlines and parentheses) is one of the commands below, and the command as a whole holds no substitution, heredoc, redirection into a file (/dev/null and 2>&1 are fine) or open quote. The list is fixed and not configurable: a project that wants more writes allow rules.

A part is COMMAND ARG... where COMMAND is on the list, written without a path, wrapper or VAR=value before it, and every ARG is a plain word (letters, digits and _@%+=:,./~^{}*?[]-) or a quoted string without $, backticks or backslashes. Nothing is expanded that could run code. The list:

  • Always read-only: ls pwd cat head tail wc echo which uname whoami id basename dirname realpath readlink stat du df cut tr nl diff sha256sum sha1sum md5sum cksum jq ps uptime nproc cd true false.

  • date to show a time (+FORMAT, -u, -R, -I, -d STRING, -r FILE), never to set it; uniq with at most one file argument (the second would be written); sort without -o / --output / --compress-program.

  • grep egrep fgrep rg without --pre, --pre-glob, --hostname-bin, -z, --search-zip (these run other programs).

  • find without -exec, -execdir, -ok, -okdir, -delete, -fprint, -fprint0, -fprintf, -fls.

  • git directly followed by status, diff, log, show, blame, describe, shortlog, rev-parse, ls-files, ls-tree, cat-file -- no global options (-c, -C, --exec-path) before the subcommand, and no --output, --ext-diff, --open-files-in-pager, --textconv, --exec-path (nor an abbreviation of one, which git accepts); and git branch / git remote / git tag only in their listing forms.

What stays open, as with any allowlist: git runs what the repository's own configuration names (a pager, core.fsmonitor, a textconv filter). The mode trusts the repository the way acceptEdits trusts the root.

covers

my $yes = Langertha::Raider::Permissions::ReadOnlyBash->covers($command);

True when every part of the command is on the list and the command holds no substitution, heredoc, redirection into a file or open quote. Callable on the class.

SEE ALSO

SUPPORT

Issues

Please report bugs and feature requests at https://github.com/Getty/langertha-raider/issues.

IRC

Join #langertha on irc.perl.org or message Getty directly.

CONTRIBUTING

Contributions are welcome! Please fork the repository and submit a pull request.

AUTHOR

Torsten Raudssus <torsten@raudssus.de> https://raudssus.de/

COPYRIGHT AND LICENSE

This software is copyright (c) 2026 by Torsten Raudssus.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

https://raudssus.de/