-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdockerfile_denylist.sh
More file actions
executable file
·39 lines (33 loc) · 984 Bytes
/
dockerfile_denylist.sh
File metadata and controls
executable file
·39 lines (33 loc) · 984 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/bash
DOCKERFILE_BACKEND="$(cat ./app/backend/Dockerfile)"
DOCKERFILE_FRONTEND="$(cat ./app/frontend/Dockerfile)"
DENY=(
"RUN npm start"
)
echo "--------------------------"
echo '-app/backend/Dockerfile---'
echo "--------------------------"
echo "$DOCKERFILE_BACKEND"
echo "--------------------------"
echo '-app/frontend/Dockerfile--'
echo "--------------------------"
echo "$DOCKERFILE_FRONTEND"
echo "--------------------------"
echo "--------------------------"
error=0
for I in "${DENY[@]}"; do
if [[ "$DOCKERFILE_BACKEND" == *"$I"* ]]; then
echo "ERRO em 'app/backend/Dockerfile': O comando '${I}' não é autorizado"
error=1
fi
if [[ "$DOCKERFILE_FRONTEND" == *"$I"* ]]; then
echo "ERRO em 'app/frontend/Dockerfile': O comando '${I}' não é autorizado"
error=1
fi
done
if [[ $error -eq 1 ]]; then
echo "--------------------------"
echo "--------------------------"
echo "O avaliador não irá continuar devido a um erro"
exit 1
fi