question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ParsedRequest filter changes from 4.3.x introduce breaking change

See original GitHub issue

I updated to 4.4.1 in early January and notice that request filter handling changed. In some controllers, it is necessary to add additional filters before handing the request off to the service for database operations (e.g. to add authorization criteria to the database query). Below is an example of how I implemented this prior to 4.3.x.

@Override()
async getMany(@ParsedRequest() req: CrudRequest, @User() user: User) {
  // Simulating user only having access to remoteId == 10

  req.parsed.filter.push({
    field: 'remoteId',
    operator: '$eq',
    value: user.remoteId,
  });

  return await this.base.getManyBase(req);
}

After upgrading to 4.4.1, I notice that these filter conditions are not incorporated when generating the database query. I tracked the change down to this commit 702603917e5e3968ae306881ff099a4907eca57a.

I have created a demonstration repository demonstrating the issue: https://github.com/iamjoeker/crud_filter_change_poc

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:1
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
iamjoekercommented, Jan 22, 2020

Let me start by saying how much I love this library and its goals and appreciate the efforts to bring it to life.

My apologies as I realize now that I probably didn’t do a good job of communicating my intent when I opened the issue.

While I concur that @CrudAuth is the preferred way to handle this starting with version 4.3 (as shared in the crud-4.4.1-working branch of my poc). My concern is that this is a BC break that happened in a minor release (which is not expected per semver). I was lucky to have discovered the issue before it resulted in significant data disclosure. I raise the issue in the hope that the BC break can be corrected and reported for others who may have been potentially impacted.

If it would be welcomed, I’m willing to submit a PR. Based on my research, fixing the BC break would require a new 4.3.x and 4.4.x release (and possibly a 5.x release with the BC break included).

1reaction
Dilukacommented, Mar 9, 2020

@tevenFr maybe try this

    req.parsed.search = {
      $and: [req.parsed.search, { isEnabled: true }],
    };

you should never modify req.options by request because of #368

but there has a bug #432 ┓( ´∀` )┏ (temporary fix patch is working)

Read more comments on GitHub >

github_iconTop Results From Across the Web

CHANGELOG.md - ory/kratos - Sourcegraph
Ory Kratos had no major changes in the APIs for the last months and feel confident that no large breaking changes will need...
Read more >
NEST Breaking Changes | Elasticsearch .NET Clients [7.17]
This lists all the binary breaking public API changes between NEST 6.8.0, the last 6.x version released when 7.0 went GA release, and...
Read more >
DATABASE SECURITY IV - DTIC
If your address has changed or if you wish to be removed from the Rome Laboratory mailing list, or if the addressee is...
Read more >
Neos 5.0 »Jabberwock« and Flow 6.0 released - Blog - Neos.io
Neos 5.0 is compatible only with Neos UI 5.0.x. ... This is a breaking change because it changes the API slightly by removing...
Read more >
Overview (Apache Juneau 9.0.0)
forEachWS( x -> x .useWhitespace()) .build(); // Find the appropriate serializer by Accept type and serialize our POJO to the specified writer.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found