From 21413e45902c14586fd0c00ba54da7ff077fcd8b Mon Sep 17 00:00:00 2001 From: Toprun123 Date: Tue, 15 Oct 2024 18:51:42 +0300 Subject: [PATCH] fix: update user/relation/object regex validation. Update the regex validation for user, relation, and object under CheckRequestTupleKey. --- openfga/v1/openfga_service.proto | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/openfga/v1/openfga_service.proto b/openfga/v1/openfga_service.proto index ada3b6b1..6548ac0e 100644 --- a/openfga/v1/openfga_service.proto +++ b/openfga/v1/openfga_service.proto @@ -1140,7 +1140,7 @@ message CheckRequest { message CheckRequestTupleKey { string user = 1 [ (google.api.field_behavior) = REQUIRED, - (validate.rules).string = {pattern: "^[^\\s]{2,512}$"}, + (validate.rules).string = {pattern: "^(?=.{2,512}$)(?:[a-z_-]+:(?:[a-zA-Z0-9_/#-]+|\*))$"}, (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { max_length: 512 example: "\"user:anne\"" @@ -1149,7 +1149,7 @@ message CheckRequestTupleKey { string relation = 2 [ (google.api.field_behavior) = REQUIRED, - (validate.rules).string = {pattern: "^[^:#@\\s]{1,50}$"}, + (validate.rules).string = {pattern: "^[a-z]{1,50}$"}, (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { max_length: 50 example: "\"reader\"" @@ -1158,7 +1158,7 @@ message CheckRequestTupleKey { string object = 3 [ (google.api.field_behavior) = REQUIRED, - (validate.rules).string = {pattern: "^[^\\s]{2,256}$"}, + (validate.rules).string = {pattern: "^(?=.{2,256}$)(?:[a-z_-]+:(?:[a-zA-Z0-9_/-]+|\*))$"}, (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { max_length: 256 example: "\"document:2021-budget\""