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

SCIM POST /Users/.search Error 500 with invalid 'count' property #718

Closed
LazaroOnline opened this issue Mar 25, 2024 · 3 comments
Closed
Assignees
Labels
bug Something isn't working

Comments

@LazaroOnline
Copy link

LazaroOnline commented Mar 25, 2024

POST /Users/.search returns error 500 with an invalid count parameter.
Example body:

{ "count": -1 }

SimpleIdServer\src\Scim\SimpleIdServer.Scim\Extensions\SCIMRepresentationExtensions.cs line 77

if (attribute.TryContainsGroupingExpression(out SCIMComplexAttributeExpression complexAttributeExpression))

EXCEPTION: MySqlConnector.MySqlException
SearchRepresentationsQueryHandler.cs:line 59

var result = await _scimRepresentationQueryRepository.FindSCIMRepresentations(new SearchSCIMRepresentationsParameter(
...
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-1 OFFSET 0
) AS `t0`
LEFT JOIN `SCIMRepresentationAttributeLst` AS `s0` ON `t' at line 10
   at MySqlConnector.Core.ServerSession.ReceiveReplyAsyncAwaited(ValueTask`1 task) in /_/src/MySqlConnector/Core/ServerSession.cs:line 962
   at MySqlConnector.Core.ResultSet.ReadResultSetHeaderAsync(IOBehavior ioBehavior) in /_/src/MySqlConnector/Core/ResultSet.cs:line 43
   at MySqlConnector.MySqlDataReader.ActivateResultSet(CancellationToken cancellationToken) in /_/src/MySqlConnector/MySqlDataReader.cs:line 130
   at MySqlConnector.MySqlDataReader.CreateAsync(CommandListPosition commandListPosition, ICommandPayloadCreator payloadCreator, IDictionary`2 cachedProcedures, IMySqlCommand command, CommandBehavior behavior, Activity activity, IOBehavior ioBehavior, CancellationToken cancellationToken) in /_/src/MySqlConnector/MySqlDataReader.cs:line 468
   at MySqlConnector.Core.CommandExecutor.ExecuteReaderAsync(IReadOnlyList`1 commands, ICommandPayloadCreator payloadCreator, CommandBehavior behavior, Activity activity, IOBehavior ioBehavior, CancellationToken cancellationToken) in /_/src/MySqlConnector/Core/CommandExecutor.cs:line 56
   at MySqlConnector.MySqlCommand.ExecuteReaderAsync(CommandBehavior behavior, IOBehavior ioBehavior, CancellationToken cancellationToken) in /_/src/MySqlConnector/MySqlCommand.cs:line 344
   at MySqlConnector.MySqlCommand.ExecuteDbDataReaderAsync(CommandBehavior behavior, CancellationToken cancellationToken) in /_/src/MySqlConnector/MySqlCommand.cs:line 337
   at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Query.Internal.SingleQueryingEnumerable`1.AsyncEnumerator.InitializeReaderAsync(AsyncEnumerator enumerator, CancellationToken cancellationToken)
   at Pomelo.EntityFrameworkCore.MySql.Storage.Internal.MySqlExecutionStrategy.ExecuteAsync[TState,TResult](TState state, Func`4 operation, Func`4 verifySucceeded, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Query.Internal.SingleQueryingEnumerable`1.AsyncEnumerator.MoveNextAsync()
   at Microsoft.EntityFrameworkCore.EntityFrameworkQueryableExtensions.ToListAsync[TSource](IQueryable`1 source, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.EntityFrameworkQueryableExtensions.ToListAsync[TSource](IQueryable`1 source, CancellationToken cancellationToken)
   at SimpleIdServer.Scim.Persistence.EF.Extensions.EFSCIMExpressionLinqExtensions.BuildResult(IQueryable`1 representations, SCIMDbContext dbContext, IEnumerable`1 includedAttributes, IEnumerable`1 excludedAttributes, Int32 total, CancellationToken cancellationToken)
   at SimpleIdServer.Scim.Persistence.EF.EFSCIMRepresentationQueryRepository.FindSCIMRepresentations(SearchSCIMRepresentationsParameter parameter, CancellationToken cancellationToken)
   at SimpleIdServer.Scim.Queries.SearchRepresentationsQueryHandler.Handle(SearchSCIMResourceParameter searchRequest, String resourceType, CancellationToken cancellationToken) in C:\SimpleIdServer\src\Scim\SimpleIdServer.Scim\Queries\SearchRepresentationsQueryHandler.cs:line 59
   at SimpleIdServer.Scim.Api.BaseApiController.InternalSearch(SearchSCIMResourceParameter searchRequest, CancellationToken cancellationToken) in C:\SimpleIdServer\src\Scim\SimpleIdServer.Scim\Api\BaseApiController.cs:line 370

Tested in the current latest of "SimpleIdServer.Scim" v4.0.7

@LazaroOnline LazaroOnline changed the title SCIM POST /Users/.search Error 500 with invalid count property SCIM POST /Users/.search Error 500 with invalid 'count' property Mar 25, 2024
@simpleidserver simpleidserver self-assigned this Mar 25, 2024
@simpleidserver simpleidserver added the bug Something isn't working label Mar 25, 2024
@simpleidserver
Copy link
Owner

This issue will be fixed in the Release 4.0.8.

@simpleidserver simpleidserver moved this from Todo to In Progress in @simpleidserver's Release 4.0.8 Mar 28, 2024
thabart added a commit that referenced this issue Apr 3, 2024
@simpleidserver
Copy link
Owner

This issue has been resolved in the master branch. When a negative value is passed, it is interpreted as "0"

@simpleidserver simpleidserver moved this from In Progress to Done in @simpleidserver's Release 4.0.8 Apr 3, 2024
@LazaroOnline
Copy link
Author

LazaroOnline commented Apr 5, 2024

Tested in the latest master branch, it now returns 200 Ok.
Thanks a lot for the quick support!

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
No open projects
Development

No branches or pull requests

2 participants