From 04a789e7f173e7a4da54711675a9b9bbc128b5c2 Mon Sep 17 00:00:00 2001 From: Geoffroy Couprie Date: Thu, 13 Feb 2020 14:57:41 +0100 Subject: [PATCH] add a test case for the caveat name check if there's a fact with the same format as a caveat's head, it will not validate the caveat --- samples/README.md | 35 +++++++++++++++++++++++++++++ samples/test16_caveat_head_name.bc | Bin 0 -> 244 bytes 2 files changed, 35 insertions(+) create mode 100644 samples/test16_caveat_head_name.bc diff --git a/samples/README.md b/samples/README.md index 14b62a8..229cab2 100644 --- a/samples/README.md +++ b/samples/README.md @@ -575,3 +575,38 @@ World { rules: [] } validation: `Ok(())` + +------------------------------ + +## caveat head name should be independent from fact names: test16_caveat_head_name.bc +biscuit: Biscuit { + symbols: ["authority", "ambient", "resource", "operation", "right", "current_time", "revocation_id", "caveat1", "test", "hello"] + authority: Block[0] { + symbols: ["caveat1", "test", "hello"] + context: "" + facts: [] + rules: [] + caveats: [ + *caveat1(#test) <- !resource(#ambient, #hello) + ] + } + blocks: [ + Block[1] { + symbols: [] + context: "" + facts: [ + !caveat1(#test) + ] + rules: [] + caveats: [] + } + ] +} +verifier world: +World { + facts: [ + "!caveat1(#test)", +] + rules: [] +} +validation: `Err(FailedLogic(FailedCaveats([Block(FailedBlockCaveat { block_id: 0, caveat_id: 0, rule: "*caveat1(#test) <- !resource(#ambient, #hello)" })])))` diff --git a/samples/test16_caveat_head_name.bc b/samples/test16_caveat_head_name.bc new file mode 100644 index 0000000000000000000000000000000000000000..d37dc7b8e27c5be470855306c6387ad87cecd217 GIT binary patch literal 244 zcmd-w<6sbCPfjdLO)N1KVkt>2E)inQNX^N~*OK9q;^N?77h>UH5a1Bv<6r`_7{Meb zkk2T^g^-t02%1;HuW?gCW?DDj>Y3$lTc#|ka&>&*(=54#)#mhUnWJ$w01#pB2YO1 literal 0 HcmV?d00001