File tree Expand file tree Collapse file tree 3 files changed +48
-1
lines changed
Expand file tree Collapse file tree 3 files changed +48
-1
lines changed Original file line number Diff line number Diff line change 77.idea
88easytexminer.egg-info
99build
10- tools
1110xflow_deploy
1211dist
1312.DS_Store
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ # init pre-commit check hook
4+ if [ ! -d .git/hooks/ ]; then
5+ mkdir .git/hooks
6+ fi
7+
8+ rm -rf .git/hooks/pre-commit
9+ cp tools/pre-commit .git/hooks/
10+ chmod a+rx .git/hooks/pre-commit
11+
12+ # other inits
13+ # python git-lfs/git_lfs.py pull
14+
15+ # compile proto files
16+ # source scripts/gen_proto.sh
17+
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+ echo " Check for sensitive information leak:"
3+ projectUrl=` git config --get remote.origin.url`
4+ user=` git config --get user.name`
5+ user_email=` git config --get user.email`
6+ STAGE_FILES=$( git diff --cached --name-only)
7+ stage_files=(${STAGE_FILES/ // } )
8+ keywords=(" LTAI[a-zA-Z0-9]{20}" " LTAI[a-zA-Z0-9]{12}" " acs:ram::[0-9]{16}:role/" )
9+
10+ result=0
11+ for i in " ${! stage_files[@]} " ; do
12+ if [ ! -e " ${stage_files[i]} " ]
13+ then
14+ continue
15+ fi
16+ for index in " ${! keywords[@]} " ; do
17+ grep -E -q ${keywords[index]} ${stage_files[i]}
18+ if [ $? -eq 0 ]
19+ then
20+ echo " Check Failed, ${stage_files[i]} contain sensitive info: pattern=${keywords[index]} , details: "
21+ grep -E ${keywords[index]} ${stage_files[i]}
22+ result=1
23+ break
24+ fi
25+ done
26+ done
27+ if [ $result -eq 0 ]; then
28+ echo " Sensitive Information Leak Check Passed."
29+ else
30+ exit 1
31+ fi
You can’t perform that action at this time.
0 commit comments