willmurnane opened a new issue, #88:
URL: https://github.com/apache/accumulo-access/issues/88

   In the process of developing [a Rust implementation of this 
specification](https://github.com/willmurnane/access-rs), I implemented [a 
check that the Rust implementation's behavior matches the Java 
code](https://github.com/willmurnane/access-rs/pull/3), and was surprised to 
find that the Java code does not implement what the ABNF says it does. 
Specifically, [the ABNF 
says](https://github.com/apache/accumulo-access/blob/main/SPECIFICATION.md) 
that access tokens include quoted strings composed of characters 0x20 and 
greater with a few exceptions, but the Java code accepts the characters 0x0 
through 0x1f, as demonstrated by running this code:
   ```java
   package test.access;
   import org.apache.accumulo.access.AccessEvaluator;
   import org.apache.accumulo.access.AccessExpression;
   import org.apache.accumulo.access.Authorizations;
   import org.apache.accumulo.access.IllegalAccessExpressionException;
   
   public class Main {
       public static void main(String[] args) {
           for (char i = 0; i < 0x25; i++) {
               String s = String.format("\"%c\"", i);
               System.out.printf("Character 0x%02x %s -> ", (int)i, s);
               try {
                   if (i == 0x22) {
                       System.out.printf("Double quote is illegal, skipping\n");
                   }
                   AccessExpression.of(s);
                   System.out.printf(" %s", AccessExpression.of(s));
                   System.out.printf(" %s", 
AccessEvaluator.of(Authorizations.of(String.format("%c", i))).canAccess(s));
                   if (i < 0x20) {
                       System.out.printf("(expected failure)\n");
                   } else {
                       System.out.printf("(expected success)\n");
                   }
               } catch (IllegalAccessExpressionException iaee) {
                   System.out.printf("%s Failed!\n", s);
               }
           }
       }
   }
   ```
   
   I'm not sure what the intended behavior is here, should the specification or 
the code be updated to match the other?


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

Reply via email to