From f9b5a4b1297aef5844f5f7531871c378bbd1dfdf Mon Sep 17 00:00:00 2001 From: Clemens Lauermann Date: Tue, 21 Apr 2020 00:15:21 +0200 Subject: [PATCH] improve git path sanity --- Jenkinsfile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index abb132b..be4726b 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -47,8 +47,12 @@ pipeline { env.GIT_PATH = env.GIT_PATH.substring(1) } if(env.GIT_PATH.startsWith("~/")) { - env.GIT_PATH = env.GIT_PATH.substring(2, (env.GIT_PATH.length() - 1)) + env.GIT_PATH = env.GIT_PATH.substring(2) } + if(env.GIT_PATH.contains("../")) { + error("GIT_PATH must not contain '../'") + ] + // be sure branch is set env.GIT_BRANCH = params.GIT_BRANCH ?: '*/master' }