Skip to content

Commit b191228

Browse files
committed
fix(setup-pgbackrest): Sanitize pgbackrest wrapper script arguments
The pgbackrest wrapper script now sanitizes arguments passed to it. This change removes potentially sensitive or command-injection-vulnerable arguments such as `--cmd`, `--repo-host-cmd`, and `--config` before executing the pgbackrest command. This enhances security by preventing accidental exposure of sensitive information.
1 parent 7345b6a commit b191228

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

ansible/tasks/setup-pgbackrest.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,9 @@
7575
ansible.builtin.copy:
7676
content: |
7777
#!/bin/bash
78-
exec sudo -u pgbackrest /var/lib/pgbackrest/.nix-profile/bin/pgbackrest "$@"
78+
_raw_args="$@"
79+
_sanitized_args=$(echo $_raw_args | sed -e 's/--cmd=[^ ]*//g; s/--repo-host-cmd=[^ ]*//g; s/--config=[^ ]*//g' )
80+
exec sudo -u pgbackrest /var/lib/pgbackrest/.nix-profile/bin/pgbackrest "$_sanitized_args"
7981
dest: '/usr/bin/pgbackrest'
8082
group: 'root'
8183
mode: '0755'

0 commit comments

Comments
 (0)