-
Notifications
You must be signed in to change notification settings - Fork 253
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
minghui.qmh
committed
Apr 7, 2022
1 parent
9c06bd9
commit 3d7e33f
Showing
3 changed files
with
48 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,6 @@ | |
.idea | ||
easytexminer.egg-info | ||
build | ||
tools | ||
xflow_deploy | ||
dist | ||
.DS_Store | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/bin/bash | ||
|
||
# init pre-commit check hook | ||
if [ ! -d .git/hooks/ ]; then | ||
mkdir .git/hooks | ||
fi | ||
|
||
rm -rf .git/hooks/pre-commit | ||
cp tools/pre-commit .git/hooks/ | ||
chmod a+rx .git/hooks/pre-commit | ||
|
||
# other inits | ||
#python git-lfs/git_lfs.py pull | ||
|
||
# compile proto files | ||
#source scripts/gen_proto.sh | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/bin/bash | ||
echo "Check for sensitive information leak:" | ||
projectUrl=`git config --get remote.origin.url` | ||
user=`git config --get user.name` | ||
user_email=`git config --get user.email` | ||
STAGE_FILES=$(git diff --cached --name-only) | ||
stage_files=(${STAGE_FILES/ // }) | ||
keywords=("LTAI[a-zA-Z0-9]{20}" "LTAI[a-zA-Z0-9]{12}" "acs:ram::[0-9]{16}:role/") | ||
|
||
result=0 | ||
for i in "${!stage_files[@]}"; do | ||
if [ ! -e "${stage_files[i]}" ] | ||
then | ||
continue | ||
fi | ||
for index in "${!keywords[@]}"; do | ||
grep -E -q ${keywords[index]} ${stage_files[i]} | ||
if [ $? -eq 0 ] | ||
then | ||
echo "Check Failed, ${stage_files[i]} contain sensitive info: pattern=${keywords[index]}, details: " | ||
grep -E ${keywords[index]} ${stage_files[i]} | ||
result=1 | ||
break | ||
fi | ||
done | ||
done | ||
if [ $result -eq 0 ];then | ||
echo "Sensitive Information Leak Check Passed." | ||
else | ||
exit 1 | ||
fi |