Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider updating user/object regex validation #188

Open
miparnisari opened this issue Aug 26, 2024 · 1 comment
Open

Consider updating user/object regex validation #188

miparnisari opened this issue Aug 26, 2024 · 1 comment

Comments

@miparnisari
Copy link
Member

miparnisari commented Aug 26, 2024

Here:

string user = 1 [
(google.api.field_behavior) = REQUIRED,
(validate.rules).string = {pattern: "^[^\\s]{2,512}$"},
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
max_length: 512
example: "\"user:anne\""
}
];
string relation = 2 [
(google.api.field_behavior) = REQUIRED,
(validate.rules).string = {pattern: "^[^:#@\\s]{1,50}$"},
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
max_length: 50
example: "\"reader\""
}
];
string object = 3 [
(google.api.field_behavior) = REQUIRED,
(validate.rules).string = {pattern: "^[^\\s]{2,256}$"},
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
max_length: 256
example: "\"document:2021-budget\""
}
];

the regexes are not checking for character length or many characters that are likely invalid such as Unicode control characters like U+0000 (null).

Originally posted by @senojj in openfga/openfga#1825 (comment)

@rhamzeh
Copy link
Member

rhamzeh commented Aug 26, 2024

Transferring this issue to the API repo

@rhamzeh rhamzeh transferred this issue from openfga/openfga Aug 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
@rhamzeh @miparnisari and others