Skip to content

Commit

Permalink
ssh_filter_btrbk.sh: further harden the shell execution environment
Browse files Browse the repository at this point in the history
• In principle the special `IFS`-variable could be set to some unexpected non-
  standard value.
  Unsetting it causes its default to be used.
• Locales and in particular their characters sets are quite complex in POSIX and
  may have many subtle implications.
  For example, the pattern matching notation (used in `case`-compound-commands
  or some forms of parameter expansion) are in principle only defined for
  character strings. While some shells handle it gracefully, the behaviour is
  undefined if, for example, the character set is UTF-8 and a variable contains
  bytes that do not form valid caracters in that.
  Actually, there are quite some more implications.

  Also, pathnames, in POSIX, are strings of bytes excluding 0x0.

  For these reasons, the locale is set to the `C`/`POSIX`-locale.

Signed-off-by: Christoph Anton Mitterer <[email protected]>
  • Loading branch information
calestyo committed Nov 21, 2022
1 parent 7db20c9 commit 0d34d67
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion ssh_filter_btrbk.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
#!/bin/sh

set -e -u

# initialise and sanitise the shell execution environment
unset -v IFS
export LC_ALL=C
export PATH='/usr/bin:/bin'

set -e -u

enable_log=
restrict_path_list=
allow_list=
Expand Down

0 comments on commit 0d34d67

Please sign in to comment.