Do not allow a standalone `*` as an ID
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 35
- Forks
- 17
- Avg merge
- 48m
- Merged PRs (30d)
- 10
Description
As part of the new validation functions, object uses the object and the type + id rules, user uses: object or object + relation or type + id
See: https://github.com/openfga/language/blob/main/pkg/js/validator/validate-rules.ts
For DX reasons, because user:* has very specific interpretation when used as a user, we should not allow objects to be user:* (user:an*ne and user:*anne* should still be allowed). Allowing them leads confusion and causes some users to mistakenly think that the below means anne will have access to all documents:
- user: user:anne
relation: viewer
object: document:*
One way of doing this is by changing this ID regex from:
[^#:\\s]+
to(?=[^\\*])[^#:\\s]+
but other methods are also OK.
The result should be that calling ValidateObject('user:*') or ValidateUser('team:*#member') should fail but ValidateUser('user:*') should succeed
Note that the OpenFGA API currently allows user:* and document:* as an object, and this would be a breaking change.
We should raise this with the server team as well as with the community to ensure that their use-cases are still being met (in case anyone is using <type>:* as an object).
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in pkg/js/validator/validate-rules.ts and inspect the validation paths for ValidateObject and ValidateUser. Confirm that ValidateObject('user:') and ValidateUser('team:#member') fail while ValidateUser('user:') succeeds, and that IDs such as user:anne remain valid. Before implementation, raise the breaking-change concern with the server team and community.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- developer-experience
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100