Skip to content

Commit

Permalink
fix: update user/relation/object regex validation.
Browse files Browse the repository at this point in the history
Update the regex validation for user, relation, and object under CheckRequestTupleKey.
  • Loading branch information
Toprun123 committed Oct 15, 2024
1 parent 94a1320 commit 21413e4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions openfga/v1/openfga_service.proto
Original file line number Diff line number Diff line change
Expand Up @@ -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\""
Expand All @@ -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\""
Expand All @@ -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\""
Expand Down

0 comments on commit 21413e4

Please sign in to comment.