浏览代码

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

jdesjean 6 年之前
父节点
当前提交
739d4f6a24
共有 1 个文件被更改,包括 6 次插入0 次删除
  1. 6 0
      desktop/libs/hadoop/src/hadoop/fs/webhdfs.py

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

@@ -544,6 +544,12 @@ class WebHdfs(Hdfs):
       token = self.get_delegation_token(self.user)
       if 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))
     return self._client._make_url(quoted_path, params)