Skip to content

Commit 5c8514d

Browse files
committed
acl: Support access rules for absent attributes
Previously, protocol did not clearly support access rules based on attribute absence. Using `STRING_EQUAL` op with empty value was an insufficiently clear notation of a missing attribute since it could cause a collision with attributes with an empty value (there are no such things now, but they may be possible in the future). `MatchType` enumeration is extended with `NOT_PRESENT` value. Being set in the `EACLRecord.Filter`, this operator will limit access rule to the objects without. The op is prohibited for system attributes so as not to create deliberately false (for known attributes) or undefined behavior (for unsupported ones). Closes #256. Signed-off-by: Leonard Lyubich <[email protected]>
1 parent d5e1aad commit 5c8514d

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

acl/types.proto

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ enum MatchType {
3333

3434
// Return true if strings are different
3535
STRING_NOT_EQUAL = 2;
36+
37+
// Absence of attribute
38+
NOT_PRESENT = 3;
3639
}
3740

3841
// Request's operation type to match if the rule is applicable to a particular
@@ -102,9 +105,13 @@ message EACLRecord {
102105

103106
// Filter to check particular properties of the request or the object.
104107
//
108+
// The `value` field must be empty if `match_type` is an unary operator
109+
// (e.g. `NOT_PRESENT`).
110+
//
105111
// By default `key` field refers to the corresponding object's `Attribute`.
106112
// Some Object's header fields can also be accessed by adding `$Object:`
107-
// prefix to the name. Here is the list of fields available via this prefix:
113+
// prefix to the name. For such attributes, field 'match_type' must not be
114+
// 'NOT_PRESENT'. Here is the list of fields available via this prefix:
108115
//
109116
// * $Object:version \
110117
// version

proto-docs/acl.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,13 @@ Describes a single eACL rule.
9595
### Message EACLRecord.Filter
9696
Filter to check particular properties of the request or the object.
9797

98+
The `value` field must be empty if `match_type` is an unary operator
99+
(e.g. `NOT_PRESENT`).
100+
98101
By default `key` field refers to the corresponding object's `Attribute`.
99102
Some Object's header fields can also be accessed by adding `$Object:`
100-
prefix to the name. Here is the list of fields available via this prefix:
103+
prefix to the name. For such attributes, field 'match_type' must not be
104+
'NOT_PRESENT'. Here is the list of fields available via this prefix:
101105

102106
* $Object:version \
103107
version
@@ -202,6 +206,7 @@ MatchType is an enumeration of match types.
202206
| MATCH_TYPE_UNSPECIFIED | 0 | Unspecified match type, default value. |
203207
| STRING_EQUAL | 1 | Return true if strings are equal |
204208
| STRING_NOT_EQUAL | 2 | Return true if strings are different |
209+
| NOT_PRESENT | 3 | Absence of attribute |
205210

206211

207212

0 commit comments

Comments
 (0)