[ 
https://issues.apache.org/jira/browse/HADOOP-17618?focusedWorklogId=586356&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-586356
 ]

ASF GitHub Bot logged work on HADOOP-17618:
-------------------------------------------

                Author: ASF GitHub Bot
            Created on: 21/Apr/21 06:28
            Start Date: 21/Apr/21 06:28
    Worklog Time Spent: 10m 
      Work Description: sumangala-patki commented on a change in pull request 
#2845:
URL: https://github.com/apache/hadoop/pull/2845#discussion_r617235044



##########
File path: 
hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/utils/UriUtils.java
##########
@@ -73,6 +93,55 @@ public static String generateUniqueTestPath() {
     return testUniqueForkId == null ? "/test" : "/" + testUniqueForkId + 
"/test";
   }
 
+  public static String maskUrlQueryParameters(List<NameValuePair> keyValueList,
+      ArrayList<String> queryParamsForFullMask,
+      ArrayList<String> queryParamsForPartialMask) {
+    StringBuilder maskedUrl = new StringBuilder();
+    for (NameValuePair keyValuePair : keyValueList) {
+      String key = keyValuePair.getName();
+      if (key.isEmpty()) {
+        throw new IllegalArgumentException("Query param key can not be empty");
+      }
+      String value = keyValuePair.getValue();
+      maskedUrl.append(key);
+      maskedUrl.append(EQUAL);
+      if (value != null && !value.isEmpty()) { //no mask
+        if (queryParamsForFullMask.contains(key)) {
+          maskedUrl.append(MASK);
+        } else if (queryParamsForPartialMask.contains(key)) {
+          int visibleLen = Math.min(4, value.length());
+          maskedUrl.append(value, 0, visibleLen);
+          maskedUrl.append(MASK);
+        } else {
+          maskedUrl.append(value);
+        }
+      }
+      maskedUrl.append(AND_MARK);
+    }
+    maskedUrl.deleteCharAt(maskedUrl.length() - 1);
+    return maskedUrl.toString();
+  }
+
+  public static String encodedUrlStr(String url) {
+    try {
+      return URLEncoder.encode(url, "UTF-8");
+    } catch (UnsupportedEncodingException e) {
+      return "https%3A%2F%2Ffailed%2Fto%2Fencode%2Furl";
+    }
+  }
+
+  public static String getMaskedUrl(URL url) {
+    String queryString = url.getQuery();
+    if (queryString == null) {

Review comment:
       check for SAS auth type




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 586356)
    Time Spent: 4h 10m  (was: 4h)

> ABFS: Partially obfuscate SAS object IDs in Logs
> ------------------------------------------------
>
>                 Key: HADOOP-17618
>                 URL: https://issues.apache.org/jira/browse/HADOOP-17618
>             Project: Hadoop Common
>          Issue Type: Sub-task
>          Components: fs/azure
>    Affects Versions: 3.3.1
>            Reporter: Sumangala Patki
>            Assignee: Sumangala Patki
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 4h 10m
>  Remaining Estimate: 0h
>
> Delegation SAS tokens are created using various parameters for specifying 
> details such as permissions and validity. The requests are logged, along with 
> values of all the query parameters. This change will partially mask values 
> logged for the following object IDs representing the security principal: 
> skoid, saoid, suoid



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-issues-h...@hadoop.apache.org

Reply via email to