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

POST /identities incorrectly applies segment overrides when using null or empty identifier, only in Core API #4976

Closed
3 of 4 tasks
rolodato opened this issue Jan 7, 2025 · 0 comments · Fixed by #5018
Closed
3 of 4 tasks
Labels
bug Something isn't working

Comments

@rolodato
Copy link
Member

rolodato commented Jan 7, 2025

How are you running Flagsmith

  • Self Hosted with Docker
  • Self Hosted with Kubernetes
  • SaaS at flagsmith.com
  • Some other way (add details in description below)

Describe the bug

Consider this feature, which is disabled at the environment level but has an override for an empty segment (% Split: 0):

Image Image

Calling the POST /identities endpoint on the Core API (or on any self-hosted setup) returns this flag as enabled.

Steps To Reproduce

$ curl --request POST \
  --url https://api.flagsmith.com/api/v1/identities/ \
  --header 'Accept: application/json' \
  --header 'X-Environment-Key: VmhZprhSPeaZuCeFQpKE5o' \
  --header 'content-type: application/json' \
  --data '{"identifier": ""}' | jq '.flags[] | select(.feature.name == "my_feature") | .enabled'
true
$ curl --request POST \
  --url https://edge.api.flagsmith.com/api/v1/identities/ \
  --header 'Accept: application/json' \
  --header 'X-Environment-Key: VmhZprhSPeaZuCeFQpKE5o' \
  --header 'content-type: application/json' \
  --data '{"identifier": ""}' | jq '.flags[] | select(.feature.name == "my_feature") | .enabled'
false

Expected behavior

Return the correct state of flags for blank identifiers.

Screenshots

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
1 participant