api icon indicating copy to clipboard operation
api copied to clipboard

fix: update user/relation/object regex validation.

Open SyedM-dev opened this issue 1 year ago • 1 comments

Update the regex validation for user, relation, and object under CheckRequestTupleKey.

Updated regular expressions used for user, relation and object under CheckRequestTupleKey in the following manner:

  • user: ^(?=.{2,512}$)(?:[a-z_-]+:(?:[a-zA-Z0-9_/#-]+|\*))$
  • relation: ^[a-z]{1,50}$
  • object: ^(?=.{2,256}$)(?:[a-z_-]+:(?:[a-zA-Z0-9_/-]+|\*))$

Description

I tried to follow the docs for this project to ensure the regex matches, if there is a mistake or edge case please correct me. This is also my first code-based PR so please correct me if i did not understand the issue properly.

References

This PR is to fix the problem mentioned in this issue #188

Review Checklist

  • [x] I have clicked on "allow edits by maintainers".
  • [x] I have added documentation for new/changed functionality in this PR or in a PR to openfga.dev [Provide a link to any relevant PRs in the references section above]
  • [x] The correct base branch is being used, if not main
  • [ ] I have added tests to validate that the change in functionality is working as expected
    • I'm sorry but I do not understand how and where I am meant to add tests for this.

SyedM-dev avatar Oct 15 '24 16:10 SyedM-dev

CLA Signed

The committers listed above are authorized under a signed CLA.

  • :white_check_mark: login: Toprun123 / name: Syed Daanish (21413e45902c14586fd0c00ba54da7ff077fcd8b, 07d9e64adc3a6315d7f1b80ebaf2b150c610dee6, d6407ed9cd4c75213635035692565c37477d6e52, 2cbcb13f462b7f6795ca14eeb776d047b60d51dd)