Skip to content

Commit

Permalink
[Security] check_approval for eval (#61344)
Browse files Browse the repository at this point in the history
* check_approval for eval
  • Loading branch information
wanghuancoder authored Jan 31, 2024
1 parent e170c05 commit 62a1261
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tools/check_file_diff_approvals.sh
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,12 @@ if [[ ${IF_USE_SUBPROCESS} ]]; then
check_approval 1 wanghuancoder
fi

IF_USE_EVAL=`git diff -U5 upstream/$BRANCH -- '*.py' | grep -B5 --no-group-separator "eval([^()]*[a-zA-Z0-9_])" || true`
if [[ ${IF_USE_EVAL} ]]; then
echo_line="You must have one RD wanghuancoder approval for using eval, which may cause security problem.\n"
check_approval 1 wanghuancoder
fi

HAS_DEFINE_FLAG=`git diff -U0 upstream/$BRANCH |grep -o -m 1 "DEFINE_int32" |grep -o -m 1 "DEFINE_bool" | grep -o -m 1 "DEFINE_string" || true`
if [ ${HAS_DEFINE_FLAG} ] && [ "${GIT_PR_ID}" != "" ]; then
echo_line="You must have one RD lanxianghit approval for the usage (either add or delete) of DEFINE_int32/DEFINE_bool/DEFINE_string flag.\n"
Expand Down

0 comments on commit 62a1261

Please # to comment.