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

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

                Author: ASF GitHub Bot
            Created on: 19/Nov/21 19:16
            Start Date: 19/Nov/21 19:16
    Worklog Time Spent: 10m 
      Work Description: virajjasani commented on a change in pull request #3683:
URL: https://github.com/apache/hadoop/pull/3683#discussion_r753453312



##########
File path: 
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/CallerContext.java
##########
@@ -74,9 +82,24 @@ public String getContext() {
         null : Arrays.copyOf(signature, signature.length);
   }
 
+  /**
+   * Whether the context is valid.
+   * The context should not contain '\t', '\n', '='.
+   * Because the context could be written to audit log.
+   */
   @InterfaceAudience.Private
   public boolean isContextValid() {
-    return context != null && !context.isEmpty();
+    if (context == null || context.isEmpty()) {
+      return false;
+    }
+
+    for (String str: ILLEGAL_CHARACTERS) {
+      if (context.contains(str)) {
+        return false;
+      }
+    }
+
+    return true;

Review comment:
       nit: could be replaced with `return 
ILLEGAL_CHARACTERS.stream().noneMatch(context::contains)`.




-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

    Worklog Id:     (was: 684072)
    Time Spent: 40m  (was: 0.5h)

> CallerContext should not include some characters
> ------------------------------------------------
>
>                 Key: HADOOP-18014
>                 URL: https://issues.apache.org/jira/browse/HADOOP-18014
>             Project: Hadoop Common
>          Issue Type: Task
>            Reporter: Takanobu Asanuma
>            Assignee: Takanobu Asanuma
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 40m
>  Remaining Estimate: 0h
>




--
This message was sent by Atlassian Jira
(v8.20.1#820001)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to