Skip to content

Cognito ListUsersCommand Filter doesn’t return results when using prefix with special character (@) #6645

@julianCast

Description

@julianCast

Checkboxes for prior research

Describe the bug

When using AWS Cognito’s ListUsersCommand with a filter on the email attribute, attempting to search with a prefix ending in @ (e.g., "email ^= "julian@""), no results are returned even if there are users with email addresses starting with [email protected]. However, appending an additional character after @ (e.g., "email ^= "julian@a""), does return results for users with email addresses that match this prefix.

Regression Issue

  • Select this option if this issue appears to be a regression.

SDK version number

@aws-sdk/client-cognito-identity-provider": "3.651.1

Which JavaScript Runtime is this issue in?

Node.js

Details of the browser/Node.js/ReactNative version

20

Reproduction Steps

1.	Use AWS Cognito’s ListUsersCommand to search for users by email prefix in a specific User Pool.
2.	Set the filter to match email addresses with a prefix ending in @, as shown below:
		const response = await cognito.send(
		  new ListUsersCommand({
		    UserPoolId: "pool-id",
		    Filter: 'email ^= "julian@"'
		  })
		);
  1. Observe the results of the command.

Observed Behavior

When executing the above code:

  • No users are returned for the filter email ^= "julian@", even if users with matching email addresses exist in the User Pool.
  • Adding a single character after the @ symbol in the filter (e.g., email ^= "julian@a") correctly returns users whose emails match the specified prefix.

Expected Behavior

The filter email ^= "julian@" should return all users with email addresses that start with julian@, regardless of what characters come after the @ symbol.

Possible Solution

The ListUsersCommand filter logic in AWS Cognito should recognize and handle special characters such as @ in a prefix context, even if they appear at the end of the filter string. This would enable searching for email prefixes with special characters without requiring additional characters afterward.

Additional Information/Context

If we have a list of users like:
[email protected], [email protected], [email protected]

We may want to just look for julian@ to exclude the rest.

Metadata

Metadata

Assignees

Labels

bugThis issue is a bug.closing-soonThis issue will automatically close in 4 days unless further comments are made.p2This is a standard priority issueresponse-requestedWaiting on additional info and feedback. Will move to \"closing-soon\" in 7 days.service-apiThis issue is due to a problem in a service API, not the SDK implementation.workaround-availableThis issue has a work around available.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions