File add-clean_id-function-to-salt.utils.verify.py.patch of Package salt

From 2c5837efa3d5f30279cd6e3fc4b277994e639a82 Mon Sep 17 00:00:00 2001
From: Ch3LL <megan.wilhite@gmail.com>
Date: Mon, 31 Jul 2017 11:50:21 -0400
Subject: [PATCH] Add clean_id function to salt.utils.verify.py

---
 salt/utils/verify.py | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/salt/utils/verify.py b/salt/utils/verify.py
index 5e320c3b59..db513ba675 100644
--- a/salt/utils/verify.py
+++ b/salt/utils/verify.py
@@ -481,12 +481,21 @@ def clean_path(root, path, subdir=False):
     return ''
 
 
+def clean_id(id_):
+    '''
+    Returns if the passed id is clean.
+    '''
+    if re.search(r'\.\.{sep}'.format(sep=os.sep), id_):
+        return False
+    return True
+
+
 def valid_id(opts, id_):
     '''
     Returns if the passed id is valid
     '''
     try:
-        return bool(clean_path(opts['pki_dir'], id_))
+        return bool(clean_path(opts['pki_dir'], id_)) and clean_id(id_)
     except (AttributeError, KeyError) as e:
         return False
 
-- 
2.13.6


openSUSE Build Service is sponsored by