Skip to content

Search user/group by with OData special charcters in search term ( e.g. @ or -) doesn't work  #7990

Closed

Description

@v-scharf

related: #7887

  • start ocis with demo users
  • einstein tries to find user marie:
  • curl -vk -ueinstein:relativity https://localhost:9200/graph/v1.0/users?%24search=mar -works
  • curl -vk -ueinstein:relativity https://localhost:9200/graph/v1.0/users?%24search=marie%40example.org - doesn't work

Actual: 400
{"error":{"code":"invalidRequest","innererror":{"date":"2023-12-15T15:22:03Z","request-id":"VIKTORS-AIR.local/zBMeJfPeNQ-001303"},"message":"Token '@example.org' is invalid"}}

Activity

  1. v-scharf commented on Dec 20, 2023

    @v-scharf
    ContributorAuthor
  2. added
    Priority:p2-high
    on Dec 20, 2023
  3. moved this from Qualification to Prio 2 in Infinite Scale Team Boardon Dec 20, 2023
  4. jvillafanez commented on Dec 20, 2023

    @jvillafanez
    Member

    This seems to be a problem with the parser, not us. The @ symbol is being interpreted by the odata parser.
    I think you need to enclose the mail within double quotes so it's interpreted as one token:
    curl -vk -ueinstein:relativity https://localhost:9200/graph/v1.0/users?%24search=%22marie%40example.org%22

    The error is gone, but it doesn't return anything for me though. If it should return anything, then we'll need to check what happens on our side.

    I'm using the admin account to prevent potential issues, but I think the behavior should be the same for any account.

  5. jvillafanez commented on Dec 20, 2023

    @jvillafanez
    Member
    {"level":"debug","service":"graph","request-id":"70850a3c746d/5zJwWxs42T-000103","backend":"ldap","base":"ou=users,o=libregraph-idm","filter":"(&(objectClass=inetOrgPerson)(|(uid=*\"[email protected]\"*)(mail=*\"[email protected]\"*)(displayName=*\"[email protected]\"*)))","scope":2,"sizelimit":0,"attributes":["displayName","owncloudUUID","mail","uid","sn","givenname","ownCloudUserEnabled","ownCloudUserType"],"time":"2023-12-20T10:27:40Z","line":"/home/juan/src/ocis/ocis/services/graph/pkg/identity/ldap.go:613","message":"GetUsers"}
    

    It seems we're searching with the double quotes if we include them, that's why I don't see any result. We need to fix this.

  6. jvillafanez commented on Dec 20, 2023

    @jvillafanez
    Member

    #8035 should fix the issue.
    I have tested only with the admin account, but the behavior should be the same for all the accounts. Note that it affects to both ldap and cs3 backends.

    As said in the PR, the double quotes will be required in order to prevent the parser from interpreting the email. If the email isn't in double quotes, the parser will still complain the same way it's doing now.

  7. rhafer commented on Dec 21, 2023

    @rhafer
    Contributor

    I'll close this, as the (un-)quoting issue was fixed in libregraph. @ScharfViktor please note that it's best to quote the search term on the request.

  8. self-assigned this
    on Dec 21, 2023
  9. moved this from Done to In progress in Infinite Scale Team Boardon Dec 21, 2023
  10. rhafer commented on Dec 21, 2023

    @rhafer
    Contributor

    Actually the same issue exists for groups obviously. I'll reopen this and work on a fix.

  11. reopened this on Dec 21, 2023
  12. changed the title [-]Search user by full email doesn't work [/-] [+]Search user/group by with OData special charcters in search term ( e.g. `@` or `-`) doesn't work [/+] on Dec 21, 2023
  13. added 2 commits that reference this issue on Dec 21, 2023
    b24b480
    9a8e2a2
  14. added a commit that references this issue on Dec 21, 2023
    d2af7f6
  15. added a commit that references this issue on Jan 24, 2024
    dccf091
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Priority:p2-highType:Bug

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions