This repository has been archived by the owner on Mar 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This commit adds a stage to the pipeline to check whether the user who submitted the PR is on a whitelist. If they are not, the pipeline stops immediately to prevent execution of untrusted code. This step is in addition to the Verify Scripts stage, which prevents execution of certain scripts from untrusted users. Signed-off-by: Adam Ludvik <[email protected]>
- Loading branch information
Adam Ludvik
committed
Mar 8, 2017
1 parent
b5f5445
commit 8ca0f67
Showing
2 changed files
with
31 additions
and
16 deletions.
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
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,20 @@ | ||
#!/bin/bash | ||
|
||
if [[ -z $1 || -z $2 ]] | ||
then | ||
echo "USAGE: $0 [user] [whitelist]" | ||
exit 1 | ||
fi | ||
|
||
whitelist=$(cat $2 | grep user | sed 's#.*: \(.*$\)#\1#') | ||
for user in $whitelist | ||
do | ||
if [[ $user == $1 ]] | ||
then | ||
echo "SUCCESS: User '$1' whitelisted" | ||
exit 0 | ||
fi | ||
done | ||
|
||
echo "FAILED: User '$1' not whitelisted." | ||
exit 1 |