Skip to content

Unscoped finds in find_with #136

@paulodeon

Description

@paulodeon

When implementing the find_with proc in the scim_attributes_map of the Group class we can write something like this:

          find_with: ->(scim_list_entry) {
            id   = scim_list_entry['value']
            type = scim_list_entry['type'] || 'User' # Some online examples omit 'type' and believe 'User' will be assumed

            case type.downcase
            when 'user' then User.find_by(uuid: id)
            when 'group' then ScimGroup.find_by(uuid: id)
            else raise Scimitar::InvalidSyntaxError, "Unrecognised type #{type.inspect}"
            end
          }

Unfortunately this is a security risk where if a malicious actor with an account had the user id of a user from another account/tenant they could access details of that user.

Is there any way to pass additional information into that function so that we could scope the finds to the tenant?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions