2020-04-01 15:40:04 +00:00
|
|
|
syntax = "proto3";
|
2020-08-05 22:10:09 +00:00
|
|
|
|
2020-08-12 21:43:51 +00:00
|
|
|
package neo.fs.v2.acl;
|
2020-08-05 22:10:09 +00:00
|
|
|
|
2023-03-07 08:50:02 +00:00
|
|
|
option go_package = "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/acl/grpc;acl";
|
2021-03-10 10:54:06 +00:00
|
|
|
option csharp_namespace = "Neo.FileStorage.API.Acl";
|
2020-04-01 15:40:04 +00:00
|
|
|
|
2020-08-05 15:07:56 +00:00
|
|
|
import "refs/types.proto";
|
2020-04-01 15:40:04 +00:00
|
|
|
|
2020-09-02 11:06:21 +00:00
|
|
|
// Target role of the access control rule in access control list.
|
|
|
|
enum Role {
|
2020-10-13 20:29:04 +00:00
|
|
|
// Unspecified role, default value
|
2020-10-19 07:52:02 +00:00
|
|
|
ROLE_UNSPECIFIED = 0;
|
2020-04-01 15:40:04 +00:00
|
|
|
|
2020-10-13 20:29:04 +00:00
|
|
|
// User target rule is applied if sender is the owner of the container
|
2020-08-11 09:03:50 +00:00
|
|
|
USER = 1;
|
2020-04-01 15:40:04 +00:00
|
|
|
|
2022-04-13 06:21:33 +00:00
|
|
|
// System target rule is applied if sender is a storage node within the
|
|
|
|
// container or an inner ring node
|
2020-08-11 09:03:50 +00:00
|
|
|
SYSTEM = 2;
|
2020-04-01 15:40:04 +00:00
|
|
|
|
2024-02-28 15:53:04 +00:00
|
|
|
// Others target rule is applied if sender is neither a user nor a system
|
|
|
|
// target
|
2020-08-11 09:03:50 +00:00
|
|
|
OTHERS = 3;
|
2020-04-01 15:40:04 +00:00
|
|
|
}
|
2020-07-08 07:22:07 +00:00
|
|
|
|
2020-08-14 19:04:56 +00:00
|
|
|
// MatchType is an enumeration of match types.
|
|
|
|
enum MatchType {
|
|
|
|
// Unspecified match type, default value.
|
|
|
|
MATCH_TYPE_UNSPECIFIED = 0;
|
2020-08-12 21:43:51 +00:00
|
|
|
|
2020-08-14 19:04:56 +00:00
|
|
|
// Return true if strings are equal
|
|
|
|
STRING_EQUAL = 1;
|
2020-08-12 21:43:51 +00:00
|
|
|
|
2020-08-14 19:04:56 +00:00
|
|
|
// Return true if strings are different
|
|
|
|
STRING_NOT_EQUAL = 2;
|
|
|
|
}
|
2020-08-12 21:43:51 +00:00
|
|
|
|
2020-10-13 20:29:04 +00:00
|
|
|
// Request's operation type to match if the rule is applicable to a particular
|
|
|
|
// request.
|
2020-08-14 19:04:56 +00:00
|
|
|
enum Operation {
|
2020-10-13 20:29:04 +00:00
|
|
|
// Unspecified operation, default value
|
2020-08-14 19:04:56 +00:00
|
|
|
OPERATION_UNSPECIFIED = 0;
|
2020-08-12 21:43:51 +00:00
|
|
|
|
2020-08-14 19:04:56 +00:00
|
|
|
// Get
|
|
|
|
GET = 1;
|
2020-08-12 21:43:51 +00:00
|
|
|
|
2020-08-14 19:04:56 +00:00
|
|
|
// Head
|
|
|
|
HEAD = 2;
|
2020-08-12 21:43:51 +00:00
|
|
|
|
2020-08-14 19:04:56 +00:00
|
|
|
// Put
|
|
|
|
PUT = 3;
|
2020-08-12 21:43:51 +00:00
|
|
|
|
2020-08-14 19:04:56 +00:00
|
|
|
// Delete
|
|
|
|
DELETE = 4;
|
2020-08-11 09:03:50 +00:00
|
|
|
|
2020-08-14 19:04:56 +00:00
|
|
|
// Search
|
|
|
|
SEARCH = 5;
|
2020-08-11 09:03:50 +00:00
|
|
|
|
2020-08-14 19:04:56 +00:00
|
|
|
// GetRange
|
|
|
|
GETRANGE = 6;
|
2020-08-12 21:43:51 +00:00
|
|
|
|
2020-08-14 19:04:56 +00:00
|
|
|
// GetRangeHash
|
|
|
|
GETRANGEHASH = 7;
|
|
|
|
}
|
2020-08-12 21:43:51 +00:00
|
|
|
|
2020-10-13 20:29:04 +00:00
|
|
|
// Rule execution result action. Either allows or denies access if the rule's
|
|
|
|
// filters match.
|
2020-08-14 19:04:56 +00:00
|
|
|
enum Action {
|
2020-10-13 20:29:04 +00:00
|
|
|
// Unspecified action, default value
|
2020-08-14 19:04:56 +00:00
|
|
|
ACTION_UNSPECIFIED = 0;
|
2020-08-11 09:03:50 +00:00
|
|
|
|
2020-08-14 19:04:56 +00:00
|
|
|
// Allow action
|
|
|
|
ALLOW = 1;
|
2020-08-11 09:03:50 +00:00
|
|
|
|
2020-08-14 19:04:56 +00:00
|
|
|
// Deny action
|
|
|
|
DENY = 2;
|
|
|
|
}
|
2020-08-12 21:43:51 +00:00
|
|
|
|
2020-10-13 20:29:04 +00:00
|
|
|
// Enumeration of possible sources of Headers to apply filters.
|
2020-08-14 19:04:56 +00:00
|
|
|
enum HeaderType {
|
|
|
|
// Unspecified header, default value.
|
|
|
|
HEADER_UNSPECIFIED = 0;
|
2020-08-12 21:43:51 +00:00
|
|
|
|
2020-08-14 19:04:56 +00:00
|
|
|
// Filter request headers
|
|
|
|
REQUEST = 1;
|
2020-07-08 07:22:07 +00:00
|
|
|
|
2020-08-14 19:04:56 +00:00
|
|
|
// Filter object headers
|
|
|
|
OBJECT = 2;
|
2021-09-08 13:47:54 +00:00
|
|
|
|
|
|
|
// Filter service headers. These are not processed by NeoFS nodes and
|
|
|
|
// exist for service use only.
|
|
|
|
SERVICE = 3;
|
2020-08-14 19:04:56 +00:00
|
|
|
}
|
|
|
|
|
2020-10-13 20:29:04 +00:00
|
|
|
// Describes a single eACL rule.
|
2020-08-14 19:04:56 +00:00
|
|
|
message EACLRecord {
|
2020-10-13 20:29:04 +00:00
|
|
|
// NeoFS request Verb to match
|
2024-02-28 15:53:04 +00:00
|
|
|
Operation operation = 1 [ json_name = "operation" ];
|
2020-07-08 07:22:07 +00:00
|
|
|
|
2020-10-13 20:29:04 +00:00
|
|
|
// Rule execution result. Either allows or denies access if filters match.
|
2024-02-28 15:53:04 +00:00
|
|
|
Action action = 2 [ json_name = "action" ];
|
2020-08-12 21:43:51 +00:00
|
|
|
|
2022-04-13 06:21:33 +00:00
|
|
|
// Filter to check particular properties of the request or the object.
|
2020-10-21 16:41:24 +00:00
|
|
|
//
|
2020-10-23 12:38:31 +00:00
|
|
|
// By default `key` field refers to the corresponding object's `Attribute`.
|
|
|
|
// Some Object's header fields can also be accessed by adding `$Object:`
|
|
|
|
// prefix to the name. Here is the list of fields available via this prefix:
|
2020-10-21 16:41:24 +00:00
|
|
|
//
|
|
|
|
// * $Object:version \
|
|
|
|
// version
|
2020-11-09 13:56:58 +00:00
|
|
|
// * $Object:objectID \
|
|
|
|
// object_id
|
2020-10-21 16:41:24 +00:00
|
|
|
// * $Object:containerID \
|
|
|
|
// container_id
|
|
|
|
// * $Object:ownerID \
|
|
|
|
// owner_id
|
|
|
|
// * $Object:creationEpoch \
|
|
|
|
// creation_epoch
|
|
|
|
// * $Object:payloadLength \
|
|
|
|
// payload_length
|
|
|
|
// * $Object:payloadHash \
|
|
|
|
// payload_hash
|
|
|
|
// * $Object:objectType \
|
|
|
|
// object_type
|
|
|
|
// * $Object:homomorphicHash \
|
|
|
|
// homomorphic_hash
|
|
|
|
//
|
2022-08-02 14:32:35 +00:00
|
|
|
// Please note, that if request or response does not have object's headers of
|
2020-12-15 14:09:07 +00:00
|
|
|
// full object (Range, RangeHash, Search, Delete), it will not be possible to
|
|
|
|
// filter by object header fields or user attributes. From the well-known list
|
|
|
|
// only `$Object:objectID` and `$Object:containerID` will be available, as
|
|
|
|
// it's possible to take that information from the requested address.
|
2020-09-02 11:06:21 +00:00
|
|
|
message Filter {
|
2020-10-13 20:29:04 +00:00
|
|
|
// Define if Object or Request header will be used
|
2024-02-28 15:53:04 +00:00
|
|
|
HeaderType header_type = 1 [ json_name = "headerType" ];
|
2020-08-12 21:43:51 +00:00
|
|
|
|
2020-10-13 20:29:04 +00:00
|
|
|
// Match operation type
|
2024-02-28 15:53:04 +00:00
|
|
|
MatchType match_type = 2 [ json_name = "matchType" ];
|
2020-07-08 07:22:07 +00:00
|
|
|
|
2020-10-13 20:29:04 +00:00
|
|
|
// Name of the Header to use
|
2024-02-28 15:53:04 +00:00
|
|
|
string key = 3 [ json_name = "key" ];
|
2020-07-08 07:22:07 +00:00
|
|
|
|
2020-10-13 20:29:04 +00:00
|
|
|
// Expected Header Value or pattern to match
|
2024-02-28 15:53:04 +00:00
|
|
|
string value = 4 [ json_name = "value" ];
|
2020-08-11 09:03:50 +00:00
|
|
|
}
|
2020-07-08 07:22:07 +00:00
|
|
|
|
2020-10-13 20:29:04 +00:00
|
|
|
// List of filters to match and see if rule is applicable
|
2024-02-28 15:53:04 +00:00
|
|
|
repeated Filter filters = 3 [ json_name = "filters" ];
|
2020-08-11 09:03:50 +00:00
|
|
|
|
2020-10-13 20:29:04 +00:00
|
|
|
// Target to apply ACL rule. Can be a subject's role class or a list of public
|
|
|
|
// keys to match.
|
2020-09-02 11:06:21 +00:00
|
|
|
message Target {
|
2020-10-13 20:29:04 +00:00
|
|
|
// Target subject's role class
|
2024-02-28 15:53:04 +00:00
|
|
|
Role role = 1 [ json_name = "role" ];
|
2020-08-11 09:03:50 +00:00
|
|
|
|
2020-10-13 20:29:04 +00:00
|
|
|
// List of public keys to identify target subject
|
2024-02-28 15:53:04 +00:00
|
|
|
repeated bytes keys = 2 [ json_name = "keys" ];
|
2020-08-11 09:03:50 +00:00
|
|
|
}
|
2020-10-13 20:29:04 +00:00
|
|
|
// List of target subjects to apply ACL rule to
|
2024-02-28 15:53:04 +00:00
|
|
|
repeated Target targets = 4 [ json_name = "targets" ];
|
2020-07-08 07:22:07 +00:00
|
|
|
}
|
|
|
|
|
2022-04-13 06:21:33 +00:00
|
|
|
// Extended ACL rules table. A list of ACL rules defined additionally to Basic
|
|
|
|
// ACL. Extended ACL rules can be attached to a container and can be updated
|
2020-10-13 20:29:04 +00:00
|
|
|
// or may be defined in `BearerToken` structure. Please see the corresponding
|
2022-04-13 06:21:33 +00:00
|
|
|
// NeoFS Technical Specification section for detailed description.
|
2020-07-08 07:22:07 +00:00
|
|
|
message EACLTable {
|
2022-04-13 06:21:33 +00:00
|
|
|
// eACL format version. Effectively, the version of API library used to create
|
2020-10-13 20:29:04 +00:00
|
|
|
// eACL Table.
|
2024-02-28 15:53:04 +00:00
|
|
|
neo.fs.v2.refs.Version version = 1 [ json_name = "version" ];
|
2020-09-02 10:53:44 +00:00
|
|
|
|
2020-10-13 20:29:04 +00:00
|
|
|
// Identifier of the container that should use given access control rules
|
2024-02-28 15:53:04 +00:00
|
|
|
neo.fs.v2.refs.ContainerID container_id = 2 [ json_name = "containerID" ];
|
2020-08-05 22:10:09 +00:00
|
|
|
|
2020-10-13 20:29:04 +00:00
|
|
|
// List of Extended ACL rules
|
2024-02-28 15:53:04 +00:00
|
|
|
repeated EACLRecord records = 3 [ json_name = "records" ];
|
2020-07-08 07:22:07 +00:00
|
|
|
}
|
2020-08-18 13:41:47 +00:00
|
|
|
|
2020-10-13 20:29:04 +00:00
|
|
|
// BearerToken allows to attach signed Extended ACL rules to the request in
|
|
|
|
// `RequestMetaHeader`. If container's Basic ACL rules allow, the attached rule
|
|
|
|
// set will be checked instead of one attached to the container itself. Just
|
|
|
|
// like [JWT](https://jwt.io), it has a limited lifetime and scope, hence can be
|
|
|
|
// used in the similar use cases, like providing authorisation to externally
|
|
|
|
// authenticated party.
|
2020-10-20 19:44:00 +00:00
|
|
|
//
|
2024-02-28 15:53:04 +00:00
|
|
|
// BearerToken can be issued only by the container's owner and must be signed
|
|
|
|
// using the key associated with the container's `OwnerID`.
|
2020-08-18 13:41:47 +00:00
|
|
|
message BearerToken {
|
2024-02-28 15:53:04 +00:00
|
|
|
// Bearer Token body structure contains Extended ACL table issued by the
|
|
|
|
// container owner with additional information preventing token abuse.
|
2020-08-18 13:41:47 +00:00
|
|
|
message Body {
|
2020-10-13 20:29:04 +00:00
|
|
|
// Table of Extended ACL rules to use instead of the ones attached to the
|
2022-03-18 14:45:32 +00:00
|
|
|
// container. If it contains `container_id` field, bearer token is only
|
2024-02-28 15:53:04 +00:00
|
|
|
// valid for this specific container. Otherwise, any container of the same
|
|
|
|
// owner is allowed.
|
|
|
|
EACLTable eacl_table = 1 [ json_name = "eaclTable" ];
|
2020-08-18 13:41:47 +00:00
|
|
|
|
2022-04-13 06:21:33 +00:00
|
|
|
// `OwnerID` defines to whom the token was issued. It must match the request
|
2020-10-20 19:44:00 +00:00
|
|
|
// originator's `OwnerID`. If empty, any token bearer will be accepted.
|
2024-02-28 15:53:04 +00:00
|
|
|
neo.fs.v2.refs.OwnerID owner_id = 2 [ json_name = "ownerID" ];
|
2020-08-18 13:41:47 +00:00
|
|
|
|
2020-11-25 10:16:52 +00:00
|
|
|
// Lifetime parameters of the token. Field names taken from
|
2020-10-13 20:29:04 +00:00
|
|
|
// [rfc7519](https://tools.ietf.org/html/rfc7519).
|
2020-08-18 13:41:47 +00:00
|
|
|
message TokenLifetime {
|
|
|
|
// Expiration Epoch
|
2024-02-28 15:53:04 +00:00
|
|
|
uint64 exp = 1 [ json_name = "exp" ];
|
2020-08-18 13:41:47 +00:00
|
|
|
|
|
|
|
// Not valid before Epoch
|
2024-02-28 15:53:04 +00:00
|
|
|
uint64 nbf = 2 [ json_name = "nbf" ];
|
2020-08-18 13:41:47 +00:00
|
|
|
|
|
|
|
// Issued at Epoch
|
2024-02-28 15:53:04 +00:00
|
|
|
uint64 iat = 3 [ json_name = "iat" ];
|
2020-08-18 13:41:47 +00:00
|
|
|
}
|
|
|
|
// Token expiration and valid time period parameters
|
2024-02-28 15:53:04 +00:00
|
|
|
TokenLifetime lifetime = 3 [ json_name = "lifetime" ];
|
2023-02-21 08:18:35 +00:00
|
|
|
|
|
|
|
// AllowImpersonate flag to consider token signer as request owner.
|
|
|
|
// If this field is true extended ACL table in token body isn't processed.
|
2024-02-28 15:53:04 +00:00
|
|
|
bool allow_impersonate = 4 [ json_name = "allowImpersonate" ];
|
2020-08-18 13:41:47 +00:00
|
|
|
}
|
|
|
|
// Bearer Token body
|
2024-02-28 15:53:04 +00:00
|
|
|
Body body = 1 [ json_name = "body" ];
|
2020-08-18 13:41:47 +00:00
|
|
|
|
|
|
|
// Signature of BearerToken body
|
2024-02-28 15:53:04 +00:00
|
|
|
neo.fs.v2.refs.Signature signature = 2 [ json_name = "signature" ];
|
2020-08-18 13:41:47 +00:00
|
|
|
}
|