Skip to content

Commit 05ea9a4

Browse files
authored
feat(main): update proto GIT_TAG to service/v0.8.0 (#137)
* feat: update proto GIT_TAG to service/v0.8.0 - Bump default GIT_TAG from service/v0.7.2 to service/v0.8.0 - Remove unnecessary lambda from re.sub in run_buf_generate() - Restore buf.gen.yaml to its original content after buf generate runs (was leaking absolute plugin path into tracked file) - Add sys.path fix in __init__.py for connect-python v0.6+ absolute import style - Regenerate all proto files from service/v0.8.0 (new: obligations, updated kasregistry/objects/unsafe/authorization) - Update test assertion to match new default tag * fix(proto-gen): use lambda replacement in re.sub to safely handle backslashes in plugin path * fix(proto): correct misleading version reference in sys.path workaround comment * fix(proto): replace sys.path mutation with sys.modules aliases for connect absolute imports * test(proto): add tests and fix two-pass stub registration for connect absolute imports * fix(proto): update connect-python to >=0.6.0 and add protoc-gen-openapiv2 dependency * chore: add Gemini config to ignore generated proto files from code review
1 parent 79a183c commit 05ea9a4

54 files changed

Lines changed: 2865 additions & 836 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gemini/config.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
code_review:
2+
ignore_patterns:
3+
- "otdf-python-proto/proto-files/**/*"
4+
- "otdf-python-proto/src/otdf_python_proto/**/*"

otdf-python-proto/proto-files/authorization/v2/authorization.proto

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ message EntityIdentifier {
2121
oneof identifier {
2222
option (buf.validate.oneof).required = true;
2323

24-
// chain of one or more entities
24+
// chain of one or more entities and at most 10
2525
entity.EntityChain entity_chain = 1 [(buf.validate.field).cel = {
2626
id: "entity_chain_required"
27-
message: "entities must be provided"
28-
expression: "has(this.entities) && this.entities.size() > 0"
27+
message: "entities must be provided and between 1 and 10 in count"
28+
expression: "has(this.entities) && this.entities.size() > 0 && this.entities.size() <= 10"
2929
}];
3030

3131
// fully qualified name of the registered resource value stored in platform policy, where in
@@ -65,11 +65,13 @@ message Resource {
6565
}
6666

6767
oneof resource {
68+
// a set of attribute value FQNs, such as those on a TDF, between 1 and 20 in count
6869
AttributeValues attribute_values = 2 [(buf.validate.field).cel = {
6970
id: "attribute_values_required"
70-
message: "if provided, resource.attribute_values must not be empty"
71-
expression: "this.fqns.size() > 0 && this.fqns.all(item, item.isUri())"
71+
message: "if provided, resource.attribute_values must be between 1 and 20 in count with all valid FQNs"
72+
expression: "this.fqns.size() > 0 && this.fqns.size() <= 20 && this.fqns.all(item, item.isUri())"
7273
}];
74+
// fully qualified name of the registered resource value stored in platform policy
7375
string registered_resource_value_fqn = 3 [(buf.validate.field).string = {
7476
min_len: 1
7577
uri: true
@@ -112,15 +114,17 @@ message GetDecisionResponse {
112114
// 1. one entity reference (actor)
113115
// 2. one action
114116
// 3. multiple resources
115-
// Note: this is a more performant bulk request for multiple resource decisions
117+
// Note: this is a more performant bulk request for multiple resource decisions, up to 1000 per request
116118
message GetDecisionMultiResourceRequest {
117119
// an entity must be identified for authorization decisioning
118120
EntityIdentifier entity_identifier = 1 [(buf.validate.field).required = true];
119121
// name on action is required
120122
policy.Action action = 2 [(buf.validate.field).required = true];
121123
repeated Resource resources = 3 [
122-
(buf.validate.field).required = true,
123-
(buf.validate.field).repeated = {min_items: 1}
124+
(buf.validate.field).repeated = {
125+
min_items: 1
126+
max_items: 1000
127+
}
124128
];
125129

126130
option (buf.validate.message).cel = {
@@ -141,7 +145,12 @@ message GetDecisionMultiResourceResponse {
141145
// This is a more performant bulk request for complex decisioning (i.e. multiple entity chains or actions on
142146
// multiple resources)
143147
message GetDecisionBulkRequest {
144-
repeated GetDecisionMultiResourceRequest decision_requests = 1;
148+
repeated GetDecisionMultiResourceRequest decision_requests = 1 [
149+
(buf.validate.field).repeated = {
150+
min_items: 1
151+
max_items: 200
152+
}
153+
];
145154
}
146155
message GetDecisionBulkResponse {
147156
repeated GetDecisionMultiResourceResponse decision_responses = 1;

otdf-python-proto/proto-files/policy/kasregistry/key_access_server_registry.proto

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ message CreateKeyRequest {
403403
Algorithm key_algorithm = 3 [(buf.validate.field).cel = {
404404
id: "key_algorithm_defined"
405405
message: "The key_algorithm must be one of the defined values."
406-
expression: "this in [1, 2, 3, 4]" // Allow ALGORITHM_EC_P256, ALGORITHM_RSA_2048, ALGORITHM_X25519, ALGORITHM_AES_256_GCM
406+
expression: "this in [1, 2, 3, 4, 5]" // Allow ALGORITHM_RSA_2048, ALGORITHM_RSA_4096, ALGORITHM_EC_P256, ALGORITHM_EC_P384, ALGORITHM_EC_P521
407407
}]; // The algorithm to be used for the key
408408
// Required
409409
KeyMode key_mode = 4 [(buf.validate.field).cel = {
@@ -445,7 +445,7 @@ message ListKeysRequest {
445445
Algorithm key_algorithm = 1 [(buf.validate.field).cel = {
446446
id: "key_algorithm_defined"
447447
message: "The key_algorithm must be one of the defined values."
448-
expression: "this in [0, 1, 2, 3, 4]" // Allow ALGORITHM_EC_P256, ALGORITHM_RSA_2048, ALGORITHM_X25519, ALGORITHM_AES_256_GCM
448+
expression: "this in [0, 1, 2, 3, 4, 5]" // Allow unspecified and object.Algorithm values for currently supported RSA bit sizes and EC curve types
449449
}]; // Filter keys by algorithm
450450

451451
oneof kas_filter {
@@ -545,15 +545,15 @@ message RotateKeyRequest {
545545
Algorithm algorithm = 2 [(buf.validate.field).cel = {
546546
id: "key_algorithm_defined"
547547
message: "The key_algorithm must be one of the defined values."
548-
expression: "this in [1, 2, 3, 4]" // Allow ALGORITHM_EC_P256, ALGORITHM_RSA_2048, ALGORITHM_X25519, ALGORITHM_AES_256_GCM
548+
expression: "this in [1, 2, 3, 4, 5]" // Allow ALGORITHM_RSA_2048, ALGORITHM_RSA_4096, ALGORITHM_EC_P256, ALGORITHM_EC_P384, ALGORITHM_EC_P521
549549
}];
550550
// Required
551551
KeyMode key_mode = 3 [
552552
(buf.validate.field).enum.defined_only = true,
553553
(buf.validate.field).cel = {
554554
id: "new_key_mode_defined"
555555
message: "The new key_mode must be one of the defined values (1-4)."
556-
expression: "this in [1, 2, 3, 4]" // Allow all defined modes
556+
expression: "this in [1, 2, 3, 4]" // Allow modes CONFIG_ROOT_KEY, PROVIDER_ROOT_KEY, REMOTE, PUBLIC_KEY_ONLY
557557
}
558558
];
559559
// Required
@@ -617,6 +617,35 @@ message SetBaseKeyResponse {
617617
SimpleKasKey previous_base_key = 2; // The previous base key, if any
618618
}
619619

620+
message MappedPolicyObject {
621+
string id = 1; // The unique identifier of the policy object
622+
string fqn = 2; // The fully qualified name of the policy object
623+
}
624+
625+
message KeyMapping {
626+
string kid = 1;
627+
string kas_uri = 2;
628+
repeated MappedPolicyObject namespace_mappings = 3; // List of namespaces mapped to the key
629+
repeated MappedPolicyObject attribute_mappings = 4; // List of attribute definitions mapped to the key
630+
repeated MappedPolicyObject value_mappings = 5; // List of attribute values mapped to the key
631+
}
632+
633+
message ListKeyMappingsRequest {
634+
oneof identifier {
635+
option (buf.validate.oneof).required = false;
636+
string id = 2 [(buf.validate.field).string.uuid = true]; // The unique identifier of the key to retrieve
637+
KasKeyIdentifier key = 3;
638+
}
639+
640+
policy.PageRequest pagination = 10; // Pagination request for the list of keys
641+
}
642+
643+
message ListKeyMappingsResponse {
644+
repeated KeyMapping key_mappings = 1; // The list of key mappings
645+
646+
policy.PageResponse pagination = 10; // Pagination response for the list of keys
647+
}
648+
620649
service KeyAccessServerRegistryService {
621650
rpc ListKeyAccessServers(ListKeyAccessServersRequest) returns (ListKeyAccessServersResponse) {
622651
option (google.api.http) = {get: "/key-access-servers"};
@@ -660,4 +689,7 @@ service KeyAccessServerRegistryService {
660689

661690
// Get Default kas keys
662691
rpc GetBaseKey(GetBaseKeyRequest) returns (GetBaseKeyResponse) {}
692+
693+
// Request to list key mappings in the Key Access Service.
694+
rpc ListKeyMappings(ListKeyMappingsRequest) returns (ListKeyMappingsResponse) {}
663695
}

otdf-python-proto/proto-files/policy/objects.proto

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ package policy;
55
import "buf/validate/validate.proto";
66
import "common/common.proto";
77
import "google/protobuf/wrappers.proto";
8+
// import "google/protobuf/struct.proto";
89

910
message SimpleKasPublicKey {
1011
Algorithm algorithm = 1;
@@ -447,7 +448,6 @@ message RegisteredResourceValue {
447448
// Common metadata
448449
common.Metadata metadata = 100;
449450
}
450-
451451
string id = 1;
452452

453453
string value = 2;
@@ -460,6 +460,50 @@ message RegisteredResourceValue {
460460
common.Metadata metadata = 100;
461461
}
462462

463+
message Obligation {
464+
string id = 1;
465+
466+
Namespace namespace = 2;
467+
468+
string name = 3;
469+
470+
repeated ObligationValue values = 4;
471+
472+
common.Metadata metadata = 100;
473+
}
474+
475+
message ObligationValue {
476+
string id = 1;
477+
478+
Obligation obligation = 2;
479+
480+
string value = 3;
481+
482+
common.Metadata metadata = 100;
483+
}
484+
485+
message ObligationTrigger {
486+
string id = 1;
487+
488+
ObligationValue obligation_value = 2;
489+
490+
Action action = 3;
491+
492+
Value attribute_value = 4;
493+
494+
common.Metadata metadata = 100;
495+
}
496+
497+
// message ObligationFulfiller {
498+
// string id = 1;
499+
500+
// ObligationValue obligation_value = 2;
501+
502+
// google.protobuf.Struct conditionals = 3;
503+
504+
// common.Metadata metadata = 100;
505+
// }
506+
463507
// Supported key algorithms.
464508
enum Algorithm {
465509
ALGORITHM_UNSPECIFIED = 0;

0 commit comments

Comments
 (0)