Repository navigation
Light versec compiler CLI tool - #226
greetingsuniverse wants to merge 13 commits into
Conversation
6241925 to
c5843c7
Compare
tianyuan129
left a comment
There was a problem hiding this comment.
I used LLM to produce rules and it reported the the code behaves differently than python-ndn in the following cases. Can you verify?
- A misspelled constraint silently removes the restriction
#key: "key"
#data: a & { typo: "allowed" } <= #key
python-ndn: rejects compilation: Pattern typo never occurs before.
Go: compiles; Check("/forbidden", "/key") returns true.
- A function constraint changes the compiled model
#key: "key"
#data: a/b & { b: $eq(a) } <= #key
| Result | python-ndn | Go PR |
|---|---|---|
| Compiles | Yes | Yes |
$eq argument tag |
1, referring to a |
0, incorrect |
Allowed signer for #data |
#key |
Signer constraint disappears |
Check /x/x under /key |
true with DEFAULT_USER_FNS |
Panics: functions unsupported |
Check /x/y under /key |
false |
Panics |
- A signing cycle passes Go’s model validation
#a: "a" <= #b
#b: "b" <= #a
python-ndn: constructing Checker rejects the signing cycle.
Go: NewLvsSchema accepts it; Check("/a", "/b") returns true.
- A trailing comment breaks Go parsing
#key: "key"
#data: "data" <= #key // comment
python-ndn: compiles; check("/data", "/key") returns true.
Go: compilation panics with Expected NEWLINE, got EOF.
|
I fixed 1 4 and 5
to fix 2 (adding function constraint support) would break existing implementations that use it because of adding user functions list as an argument, or I can just add a separate function such as NewLvsSchemaFns that does the same thing but accepts user functions list also 3 is caused by the python-ndn checker sanity check which constructs the tree and traverses to detect this loop, ndnd doesn't but I'm not sure if allowing this behavior is really a big issue (the python-ndn compiler even allows it to compile) |
compiling function constraints has not been tested (function constraints are not implemented in ndnd yet)