Skip to content

Commit

Permalink
Merge branch 'check_harmful_cmd' of https://github.com/opea-project/G…
Browse files Browse the repository at this point in the history
…enAIExamples into check_harmful_cmd
  • Loading branch information
VincyZhang committed Nov 22, 2024
2 parents 0b9a4c7 + 415c497 commit 83d10e8
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions .github/workflows/scripts/check_cmd_injection.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,21 @@ do
fi
# get added command
git diff main ${file} | grep "^\+.*" | grep -v "^+++" | sed "s|\+||g" > ${WORKSPACE}/diff_file
#cat diff_file | while read line; do
# echo $line;
# for (( i=0; i<${#check_list[@]}; i++)); do
#cat diff_file | while read line; do
# echo $line;
# for (( i=0; i<${#check_list[@]}; i++)); do
# if [[ $line == *"${check_list[$i]}"* ]]; then
# echo "Found Dangerous Command: $line in $file, Please Check"
# status="failed"
# fi;
# done;
# fi;
# done;
#done
for (( i=0; i<${#check_list[@]}; i++)); do
for (( i=0; i<${#check_list[@]}; i++)); do
if [[ $(cat diff_file | grep -c "${check_list[$i]}") != 0 ]]; then
echo "Found Dangerous Command: $line in $file, Please Check"
status="failed"
fi;
done;
fi;
done;
done
[[ -f ${WORKSPACE}/diff_file ]] && rm -f ${WORKSPACE}/diff_file
[[ $status == "failed" ]] && exit 1 || exit 0

0 comments on commit 83d10e8

Please sign in to comment.