Commit Graph

31 Commits

Author SHA1 Message Date
Geoffroy Couprie
b98e7b76f5
add a new message format for authorizer snapshots (#122)
* add a new message format for authorizer snapshots

the fact scopes have to be transmitted if we want to replay an
authorizers behaviour. AuthorizerPolicies can be kept as a way to share
plicies to bootstrap the authorizer

* update the format
2023-02-22 22:34:05 +01:00
Clement Delafargue
08da11aef5 Add NotEqual to the protobuf schema 2022-12-26 22:51:25 +01:00
Geoffroy Couprie
f8c5a86668
missing update to the schema for "check all" (#121)
Co-authored-by: Clément Delafargue <clement@delafargue.name>
2022-12-22 22:53:37 +01:00
Clément Delafargue
8c8c433e9b
SPEC: add support for bitwise operators on booleans (#112)
Such operators are only valid for v4 blocks

Co-authored-by: Geoffroy Couprie <contact@geoffroycouprie.com>
2022-11-07 23:48:55 +01:00
Clement Delafargue
e4c598f4d9
3rd party: improve Scope pb definition
The stored value is the index of a public key,
not a block index
2022-11-07 09:58:20 +01:00
Clement Delafargue
634cf46aca
3rd-party: add new protobuf fields and messages
- externalSignature allows to attach an optional signature (from a non-ephemeral private key)
  to biscuit blocks
- scope lets blocks and rules specify which facts can be loaded (either through keywords
  for selecting groups of blocks, or through public keys for blocks signed by a specific
  key)
- publicKeys provides a way to intern public keys in a way similar to symbols. Only public
  keys referenced in datalog elements can be interned
- ThirdPartyBlockRequest / ThirdPartyBlockContents provide a way to add a signed 3rd party block
  to a given biscuit token without disclosing the token itself. For that, the request needs to
  provide:
    - the public key of the last block (needed to pin the signature to a specific biscuit token)
    - the list of already interned public keys (needed to properly generate the datalog ast).
      Contrary to public keys, interned symbols are not shared to 3rd party blocks to prevent
      information leaks.
  The response provides the serialized block, as well as the associated signature.
2022-11-07 09:58:19 +01:00
Clément Delafargue
e08d8e758d
proto: remove now-unused constraints (#101) 2022-03-22 12:41:55 +01:00
Geoffroy Couprie
16357ce0fd rename verifier to authorizer 2021-10-05 23:45:38 +02:00
Geoffroy Couprie
f38c856c78 the key is now serialized with an enum indicating its algorithm
this will open the way t other urves or algorithms, like P256
2021-09-24 23:37:28 +02:00
Geoffroy Couprie
6c9f12d4b6 rename ID to Term in the protobuf schema 2021-09-12 15:18:19 +02:00
Geoffroy Couprie
a195fb4a4c remove the symbol type
symbols were a kind of strings with less available operations and some
specific optimizations: they store in index into a symbol table carried
by the token, to reduce size by avoiding repetitions.
They were too confusing for users, and now that #authority and #ambient
are gone, we can remove them completely.
The symbol table was useful though, so now the symbol table is used for
all predicate names and strings
2021-09-06 21:54:32 +02:00
Geoffroy Couprie
264dbb0aa4 start updating the schema for v2
- remove v0 compatibility
- convert v1 to v2
- remove the index from blocks (now the cryptographisc design guarantees
the order
2021-09-03 21:59:14 +02:00
Geoffroy Couprie
d91e055156 new cryptographic scheme 2021-09-03 18:37:09 +02:00
Geoffroy Couprie
f3785126d7 add a format to transport verifier state
there are two use cases for this:
- quickly loading verifier policies from a serialized state instead of
manually adding datalog elements one by one through the verifier API.
The policies could even be written in a different system then published
to running instances dynamically
- save the state of a verifier, including ambient data, facts, rules and
checks coming from a token, to later load it into another verifier and inspect
it
2021-03-04 14:21:06 +01:00
Geoffroy Couprie
e272bdd08b missing schema update 2021-02-26 17:55:27 +01:00
Geoffroy Couprie
01ea43fa9b method syntax for set and string expressions
this commit introduces a method-like syntax for these operations:
- .starts_with()
- .ends_with()
- .matches()
- .contains() (replacing the In operation)

There is no satisfying name to replace the "not in" operation, so it is
replaced by a "contains" and negation, like this: "!set.contains($var)".
The NotIn operation is removed from the V1 schema
2021-01-26 14:41:15 +01:00
Geoffroy Couprie
fedca762f9 support parenthesis in expressions
it needs to be suported in the bytecode, to let us print the expressions
properly
2021-01-26 10:52:39 +01:00
Geoffroy Couprie
fea8c3327f rename caveat to check, introduce allow/deny policies and new syntax
the meaning of "caveat" was not clear enough for users (outside of those
already familiar with macaroons), while "check" is more obvious: in a
"checklist", all items must be validated.

Allow and deny policies can be added only in the verifier (not in
tokens so there's no format change here). They use rules under the hood
like checks, and are tested one by one until one of them matches.
A default policy should be added to the verifier, otherwise it will
return the NoMatchingPolicy error. To keep the current behaviour of
accepting the request once all checks have been validated, we use the
default policy "allow if true", that only contains the expression
"true".

At last, we introduce a new syntax for checks and policies:

caveat1($0) <- resource(#ambient, $0), operation(#ambient, #read), right(#authority, $0, #read)

is rewritten as:

check if resource(#ambient, $0), operation(#ambient, #read), right(#authority, $0, #read)

Similarly, allow and deny policies use "allow if" and "deny if"
prefixes. If a check contains multiple rules, they are separated with
"or". All of those keywords are case insensitive.
2021-01-25 16:50:15 +01:00
Geoffroy Couprie
ec99146e46 replace constraints with expressions
Expressions are a superset of constraints, they can support multiple
variables, and other operations like additions
2021-01-22 16:00:19 +01:00
Geoffroy Couprie
f5169d225f add the set type 2021-01-08 16:43:35 +01:00
Geoffroy Couprie
0954e32224 add boolean type 2021-01-08 15:30:13 +01:00
Geoffroy Couprie
0ec07df89d use oneof in the Protobuf schema
this simplifies the format, using oneof instead of a 'Kind' enum with
optional fields. Additionally, it reduces token size
2021-01-06 11:23:15 +01:00
Geoffroy Couprie
456549d82a rename integer constraints 2021-01-05 15:50:14 +01:00
Geoffroy Couprie
51862ad460 duplicate messages for v1
currently the messages have the same structure as v0, but they will
change significantly
2021-01-05 15:02:44 +01:00
Geoffroy Couprie
43e975e680 version field in block format
this changes the Protobuf format to add a version field to blocks, set
to 0 for now. This change will ship in the 0.9 version of the Rust
version.

When deserializing a token, we wil check the version field. if not
present, we assume the block is at version 0. A token can contain blocks
with different versions, so a token generated by an old library can be
attenuated by a newer one.

If the version is higher than the maximum one for the library, the token
will be rejected
2021-01-04 16:22:26 +01:00
Geoffroy Couprie
1529a2e5df Add the byte array type
this will be useful to transport arbitrary data in the token without
encoding it in base 64
2020-09-11 16:53:57 +02:00
Geoffroy Couprie
90df050551 a Caveat can now contain multiple rules
This allows us to implement "OR" for caveats: one of the provided rules
has to succeed
2020-09-11 16:52:55 +02:00
Geoffroy Couprie
f6382444eb update the schema 2019-11-25 11:04:08 +01:00
Geoffroy Couprie
a0c6952123 format modification: every block can have rules and facts
before:
- rules in an authority block are authority facts generation rules
- rules in other blocks are caveats

now:
- rules in an authority block are authority facts generation rules
- rules in other block are facts generation rules for this block's validation
- caveats in the authority block are tested once at the beginning of
the validation
- caveats in an other block are specific to that block's validation
2019-10-29 11:57:13 +01:00
Geoffroy Couprie
653f534b1b update the schema for aggregated gamma signatures
the new signatures are smaller
2019-09-04 14:41:22 +02:00
Geoffroy Couprie
68cfd6f340 move to protobuf 2019-04-01 17:41:20 +02:00