From 469bea099b241f849b512910a28668ae202a3ca4 Mon Sep 17 00:00:00 2001
From: Igor Witz <igor.witz@etu.utc.fr>
Date: Wed, 29 May 2019 12:25:56 +0200
Subject: [PATCH] Update decrypt-secrets.sh, .gitlab-ci.yml,
 pica-etherpad/clair-whitelist.yml files

---
 .gitlab-ci.yml                    |  2 ++
 decrypt-secrets.sh                | 13 ++++++++-----
 pica-etherpad/clair-whitelist.yml |  2 +-
 3 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 932cd761..a7b0430e 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -13,6 +13,8 @@ stages:
 # build the container that further steps will run in in order to avoid duplicating instructions between steps
 test-pgp:
     stage: test-pgp
+    variables:
+        PICA_ENVIRONMENT: "TEST"
     before_script:
         - apk add gnupg
         - chmod +x decrypt-secrets.sh
diff --git a/decrypt-secrets.sh b/decrypt-secrets.sh
index 23e536b9..72cf0250 100644
--- a/decrypt-secrets.sh
+++ b/decrypt-secrets.sh
@@ -1,11 +1,14 @@
 #!/bin/sh
 
+# import the PGP key for the right environment
 echo "$PRIVATE_GPG_KEY_TEST" > /tmp/test
 cat  /tmp/test | gpg --import
-echo "PRIVATE_GPG_KEY_TEST" | gpg --import
-#echo $PRIVATE_GPG_KEY_TEST | tr '_' '\n'
-#echo $PRIVATE_GPG_KEY_TEST | tr '_' '\n' | gpg --import
 
+# decrypt the secrets
+SECRETS_PATH=$MODIFIED_IMAGE/secrets/encrypted-variables-$(echo $PICA_ENVIRONMENT | tr '[:upper:]' '[:lower:]')
+echo $SECRETS_PATH
 
-SANITIZED_KEY=$(cat -e key-test | sed 's/\$/\\n/g')
-
+for $encrypted_secret in $SECRETS_PATH;
+do
+    echo $encrypted_secret
+done
\ No newline at end of file
diff --git a/pica-etherpad/clair-whitelist.yml b/pica-etherpad/clair-whitelist.yml
index 59586120..c45b2060 100644
--- a/pica-etherpad/clair-whitelist.yml
+++ b/pica-etherpad/clair-whitelist.yml
@@ -20,4 +20,4 @@ generalwhitelist:
     CVE-2017-12424: shadow -> Pas de contre mesure
     CVE-2018-6954: systemd -> Pas de contre mesure
     CVE-2018-15686: systemd -> Pas de contre mesure
-    CVE-2018-6797: Perl est une dépendance du client mysql et la version non vulnérable dans stretch n'a pas été backportée -> Pas de contre-mesure
+    CVE-2018-6797: Perl est une dépendance du client mysql et la version non vulnérable dans stretch n'a pas été backportée -> Pas de contre-mesure 
-- 
GitLab