Skip to content

^$* and !^$* with null parse, then throw when the query runs #212

Open

Description

@pdevito3

Summary

^$* and !^$* with null parse with no error, then throw when the query runs. This is the collection form of #210. v1.17.0 fixed ==* and !=*, but not these two operators.

Repro (QueryKit 1.17.0, Npgsql EF Core 10.0.0)

public class Item { public int Id { get; set; } public List<string> Tags { get; set; } = []; }

rows.AsQueryable().Where(FilterParser.ParseFilter<Item>("Tags ^$* null")).Count();   // NullReferenceException
db.Items.ApplyQueryKitFilter("Tags ^$* null").ToQueryString();                      // InvalidOperationException
Filter In memory EF Core ToQueryString()
Tags ^$ null OK OK
Tags !^$ null OK OK
Tags ^$* null NullReferenceException InvalidOperationException
Tags !^$* null NullReferenceException InvalidOperationException
Tags ^^ null, ^^*, @=*, _=* QueryKitParsingException QueryKitParsingException

A downstream app found it with an operator sweep over each list, against Postgres. On 1.16.2 the app refused these filters itself. When it removed that check for 1.17.0, the sweep gave a 500 for permissions ^$* null and permissions !^$* null.

Proposal

Make ^$* and !^$* refuse null at parse, with QueryKitParsingException, Reason = RefusesNull, and the same message as ==*. ^$ and !^$ with null keep their current behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions