Skip to content

Some string permission conditions behave unexpectedly when the value is null #64

Description

@robere2

By default, the Guest group currently has permission to read Productions that match the following condition:

{
    "NOT": {
        "teamNotes": {
            "startsWith": "private"
        }
    }
}

This allows us to add the word "private" to the start of team notes in order to make it visible only to members. However, if the teamNotes field is null, the rule check will fail, preventing them from seeing the production, despite the fact that its teamNotes fielld obviously does not start with "private". This may or may not have something to do with the fact that it's an inverted condition (i.e., the NOT).

A temporary workaround for situations like this is to add an explicit condition for when the value is null:

{
    "OR": [
        {
            "teamNotes": null
        },
        {
            "NOT": {
                "teamNotes": {
                    "startsWith": "private"
                }
            }
        }
    ]
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Complexity: EXTREMEThis issue involves resolving complex features and/or understanding the project trajectoryModule: APIThis issue pertains to the apps/api modulePriority: LOWThis issue isn't critical, security-related, or significantly beneficial to users.Type: BugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions