You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zeppelin.apache.org by zj...@apache.org on 2019/09/11 04:52:18 UTC
[zeppelin] branch branch-0.8 updated: [ZEPPELIN-1070]: Inject
Credentials in any Interpreter-Code - 0.8x
This is an automated email from the ASF dual-hosted git repository.
zjffdu pushed a commit to branch branch-0.8
in repository https://gitbox.apache.org/repos/asf/zeppelin.git
The following commit(s) were added to refs/heads/branch-0.8 by this push:
new 9e981b6 [ZEPPELIN-1070]: Inject Credentials in any Interpreter-Code - 0.8x
9e981b6 is described below
commit 9e981b6f70d2d9a87b77872512c05df252035469
Author: Pascal Pellmont <gi...@ppo2.ch>
AuthorDate: Tue Sep 10 14:45:20 2019 -0400
[ZEPPELIN-1070]: Inject Credentials in any Interpreter-Code - 0.8x
### What is this PR for?
This PR is a re-submission of the original ZEPPELIN-1070 PR. The original PR seems to be abandoned and I am currently creating custom builds of Zeppelin with the ZEPPELIN-1070 PR included so I am interested in getting the PR merged. I am submitting two PRs one for 0.8X branch and one that includes fixes for merge conflicts to the master branch.
Original PR Description:
> This PR enables a generic syntax for inserting credentials. A username can be inserted by $[user.entry] where "entry" is the name of the credential. A password can be inserted by $[password.entry].
> To avoid output of the password all occurences of the password-String in the Interpreter-output will be replaced by "###". This should not be a really secure feature (since the runner of the notebook knows the password anyway), but it should avoid accidential exposure of the used passwords by any sort of interpreter
### What type of PR is it?
Feature
### Todos
* [ ] - Documentation
### What is the Jira issue?
https://issues.apache.org/jira/browse/ZEPPELIN-1070
### How should this be tested?
Unit tests are included in PR
### Screenshots (if appropriate)
### Questions:
* Does the licenses files need update? **No**
* Is there breaking changes for older versions? **Only in very unlikely circumstances. IE: code that matched {user.VALID_CREDENTIAL_ENTITY} or {password.VALID_CREDENTIAL_ENTITY}.**
* Does this needs documentation? **Yes**
Author: Pascal Pellmont <gi...@ppo2.ch>
Author: jpmcmu <jp...@gmail.com>
Author: James McMullan <jp...@gmail.com>
Closes #3415 from jpmcmu/ZEPPELIN-1070-0.8 and squashes the following commits:
6f4da84d4 [James McMullan] Merge branch 'branch-0.8' into ZEPPELIN-1070-0.8
327168490 [jpmcmu] Quoted password before replacement to allow $ and / in passwords.
66e69441e [jpmcmu] Code review changes
7e56bf443 [jpmcmu] Code review changes
de714c31c [Pascal Pellmont] [ZEPPELIN-1070] if credential entry is not found then leave the pattern as is
21d9556db [Pascal Pellmont] [ZEPPELIN-1070] Replaced $[...] pattern with {...} pattern
e7060f56d [Pascal Pellmont] [ZEPPELIN-1070] Inject Credentials in any Interpreter-Code
---
.../main/java/org/apache/zeppelin/notebook/CredentialInjector.java | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/CredentialInjector.java b/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/CredentialInjector.java
index bc683a7..7f7226f 100644
--- a/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/CredentialInjector.java
+++ b/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/CredentialInjector.java
@@ -56,7 +56,8 @@ class CredentialInjector {
UsernamePassword usernamePassword = creds.getUsernamePassword(key);
if (usernamePassword != null) {
String value = usernamePassword.getUsername();
- replaced = matcher.replaceFirst(value);
+ String quotedValue = Matcher.quoteReplacement(value);
+ replaced = matcher.replaceFirst(quotedValue);
matcher = userpattern.matcher(replaced);
}
}
@@ -67,7 +68,8 @@ class CredentialInjector {
if (usernamePassword != null) {
passwords.add(usernamePassword.getPassword());
String value = usernamePassword.getPassword();
- replaced = matcher.replaceFirst(value);
+ String quotedValue = Matcher.quoteReplacement(value);
+ replaced = matcher.replaceFirst(quotedValue);
matcher = passwordpattern.matcher(replaced);
}
}