Эх сурвалжийг харах

HUE-8788 [fb] Fix security error with webhdfs redirect

jdesjean 6 жил өмнө
parent
commit
739d4f6a24

+ 6 - 0
desktop/libs/hadoop/src/hadoop/fs/webhdfs.py

@@ -544,6 +544,12 @@ class WebHdfs(Hdfs):
       token = self.get_delegation_token(self.user)
       token = self.get_delegation_token(self.user)
       if token:
       if token:
         params['delegation'] = token
         params['delegation'] = token
+        # doas should not be present with delegation token as the token includes the username
+        # https://hadoop.apache.org/docs/r1.0.4/webhdfs.html
+        if 'doas' in params:
+          del params['doas']
+        if 'user.name' in params:
+          del params['user.name']
     quoted_path = urllib.quote(smart_str(path))
     quoted_path = urllib.quote(smart_str(path))
     return self._client._make_url(quoted_path, params)
     return self._client._make_url(quoted_path, params)