Skip to content

Implementation does not match specification #88

@willmurnane

Description

@willmurnane

In the process of developing a Rust implementation of this specification, I implemented a check that the Rust implementation's behavior matches the Java code, and was surprised to find that the Java code does not implement what the ABNF says it does. Specifically, the ABNF says 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:

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions