[ 
https://issues.apache.org/jira/browse/HBASE-11438?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14083297#comment-14083297
 ] 

Anoop Sam John commented on HBASE-11438:
----------------------------------------

{quote}
Use this if any of the unicode characters are to be used
+   * as visibility expressions and characters like '"','\','&','|','!' etc
{quote}
Use this if unicode characters to be used in expression or special characters 
like '(', ')', '"','\','&','|','!'.
Same update at quote(byte[] auth) also.


Visibility label validation logic has to include the logic of skipping the 
valid char check when the chars are enclosed wih quotes (?)  Do we use this 
validation for labels during addLabel() , during Mutation writes and for labels 
in Authorizations?

Missing a test case where addLabel and then the Mutation write with labels 
having special boolean operators with a label itself.  -  Single label       A 
& (B | C) 

{code}
+        case DOUBLE_QUOTES:
+          int labelOffset = ++index;
+          // We have to rewrite the expression within double quotes as incase 
of expressions 
+          // with escape characters we may have to avoid them as the original 
expression did
+          // not have them
+          List<Byte> list = new ArrayList<Byte>();
+          while (index < endPos && !endDoubleQuotesFound(exp[index])) {
+            if (exp[index] == '\\') {
+              index++;
+              if (exp[index] != '\\' && exp[index] != '"')
+                throw new ParseException("invalid escaping with quotes " + 
expS + " at column : "
+                    + index);
+            }
+            list.add(exp[index]);
+            index++;
           }

{code}
Why to have a List of Bytes and then do array convert and then String creation? 
 Instead just track the begin and end offset and finally create the String 
using this 2 offset.


{code}
-        if (VisibilityLabelsValidator.isValidLabel(label)) {
-          if (this.visibilityManager.getLabelOrdinal(labelStr) > 0) {
-            RegionActionResult.Builder failureResultBuilder = 
RegionActionResult.newBuilder();
-            failureResultBuilder.setException(ResponseConverter
-                .buildException(new LabelAlreadyExistsException("Label '" + 
labelStr
-                    + "' already exists")));
-            response.addResult(failureResultBuilder.build());
-          } else {
-            Put p = new Put(Bytes.toBytes(ordinalCounter));
-            p.addImmutable(
-                LABELS_TABLE_FAMILY, LABEL_QUALIFIER, label, 
LABELS_TABLE_TAGS);
-            if (LOG.isDebugEnabled()) {
-              LOG.debug("Adding the label "+labelStr);
-            }
-            puts.add(p);
-            ordinalCounter++;
-            response.addResult(successResult);
-          }
-        } else {
+        if (this.visibilityManager.getLabelOrdinal(labelStr) > 0) {
           RegionActionResult.Builder failureResultBuilder = 
RegionActionResult.newBuilder();
           failureResultBuilder.setException(ResponseConverter
-              .buildException(new InvalidLabelException("Invalid visibility 
label '" + labelStr
-                  + "'")));
+              .buildException(new LabelAlreadyExistsException("Label '" + 
labelStr
+                  + "' already exists")));
           response.addResult(failureResultBuilder.build());
{code}
Where else do we do this validation then?


> [Visibility Controller] Support UTF8 character as Visibility Labels
> -------------------------------------------------------------------
>
>                 Key: HBASE-11438
>                 URL: https://issues.apache.org/jira/browse/HBASE-11438
>             Project: HBase
>          Issue Type: Improvement
>          Components: security
>    Affects Versions: 0.98.4
>            Reporter: ramkrishna.s.vasudevan
>            Assignee: ramkrishna.s.vasudevan
>             Fix For: 0.98.5
>
>         Attachments: HBASE-11438_v1.patch, HBASE-11438_v2.patch, 
> HBASE-11438_v3.patch, HBASE-11438_v4.patch, HBASE-11438_v5.patch, 
> HBASE-11438_v6.patch, HBASE-11438_v7.patch
>
>
> This would be an action item that we would be addressing so that the 
> visibility labels could have UTF8 characters in them.  Also allow the user to 
> use a client supplied API that allows to specify the visibility labels inside 
> double quotes such that UTF8 characters and cases like &, |, ! and double 
> quotes itself could be specified with proper escape sequence.  Accumulo too 
> provides one such API in the client side.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to