Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
ScharfViktor opened this issue Dec 15, 2023 · 6 comments
Assignees
Labels
Priority:p2-high Escalation, on top of current planning, release blocker Type:Bug

Comments

@ScharfViktor
Copy link
Contributor

ScharfViktor commented Dec 15, 2023

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"}}

@ScharfViktor ScharfViktor mentioned this issue Dec 19, 2023
71 tasks
@ScharfViktor
Copy link
Contributor Author

cc @jvillafanez

@micbar micbar added the Priority:p2-high Escalation, on top of current planning, release blocker label Dec 20, 2023
@jvillafanez
Copy link
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.

@jvillafanez
Copy link
Member

{"level":"debug","service":"graph","request-id":"70850a3c746d/5zJwWxs42T-000103","backend":"ldap","base":"ou=users,o=libregraph-idm","filter":"(&(objectClass=inetOrgPerson)(|(uid=*\"marie@example.org\"*)(mail=*\"marie@example.org\"*)(displayName=*\"marie@example.org\"*)))","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.

@jvillafanez
Copy link
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.

@rhafer
Copy link
Contributor

rhafer commented Dec 21, 2023

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.

@rhafer
Copy link
Contributor

rhafer commented Dec 21, 2023

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

@rhafer rhafer reopened this Dec 21, 2023
@rhafer rhafer 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 Dec 21, 2023
rhafer added a commit to rhafer/ocis that referenced this issue Dec 21, 2023
rhafer added a commit to rhafer/ocis that referenced this issue Dec 21, 2023
@rhafer rhafer closed this as completed in a1ed2ce Dec 21, 2023
2403905 pushed a commit to 2403905/ocis that referenced this issue Jan 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority:p2-high Escalation, on top of current planning, release blocker Type:Bug
Projects
Status: Done
Development

No branches or pull requests

4 participants