maticzav / graphql-shield

🛡 A GraphQL tool to ease the creation of permission layer.
https://graphql-shield.com
MIT License
3.55k stars 172 forks source link

Wrong order in RuleChain and RuleRace evaluation #828

Open Sytten opened 4 years ago

Sytten commented 4 years ago

Describe the bug

Here: https://github.com/maticzav/graphql-shield/blob/master/src/rules.ts#L395 And here: https://github.com/maticzav/graphql-shield/blob/master/src/rules.ts#L449

The concatenation is wrong, it will in reverse order compared to the order of the rules potentially leading to some unwanted behaviours.

They should be replaced by [res, ...res] to keep the order of the rules.

open-collective-bot[bot] commented 4 years ago

Hey @Sytten :wave:,

Thank you for opening an issue. We will get back to you as soon as we can. Also, check out our Open Collective and consider contributing financially.

https://opencollective.com/graphql-shield

PS.: We offer priority support for all financial contributors. Don't forget to add priority label once you start contributing :smile:

maticzav commented 4 years ago

Hey 👋 ,

Thank you for finding it out! Could you compose a small PR?

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

maticzav commented 4 years ago

Not stale.

Sytten commented 4 years ago

Sorry i didnt have time to work on this. Will try to send a PR otherwise I implemented the algo in nexus-shield feel free to copy it.

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Sytten commented 4 years ago

Not stale.