Skip to content
This repository has been archived by the owner on Nov 20, 2023. It is now read-only.

Commit

Permalink
fix: don't run arbitrary commands with script
Browse files Browse the repository at this point in the history
* scripts are now called with their absolute paths instead of ./
  • Loading branch information
xynydev committed Aug 13, 2023
1 parent bbb1cc8 commit dc97fa4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
10 changes: 5 additions & 5 deletions config/recipe.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@ image-version: 38

modules:
- type: script
run: # commands directly run inside scripts directory
- ./autorun.sh pre
scripts:
- autorun.sh pre

- from-file: common-packages.yml # paths relative to "config" directory

- type: script
run:
scripts:
# this sets up the proper policy & signing files for signed images to work
- ./signing.sh
- ./autorun.sh post
- signing.sh
- autorun.sh post


- type: yafti # no need for an enable-disable key, inclusion implicitly enables
Expand Down
8 changes: 4 additions & 4 deletions modules/script/script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
# Tell build process to exit if there are any errors.
set -oue pipefail

get_yaml_array RUN '.run[]' "$1"
get_yaml_array SCRIPTS '.scripts[]' "$1"

cd "$CONFIG_DIRECTORY/scripts"

find "$PWD" -type f -exec chmod +x {} \;

for CMD in "${RUN[@]}"; do
echo "Running command: $CMD"
eval "$CMD"
for SCRIPT in "${SCRIPTS[@]}"; do
echo "Running script $SCRIPT"
eval "$PWD/$SCRIPT"
done

0 comments on commit dc97fa4

Please sign in to comment.