Mixing read action in `action_type` policy condition with other types; Error instead of filtering
Hi all,
After upgrading to Ash
3.7.0 my tests for asserting that actions under policies requiring an actor being present started throwing Ash.Errors.Forbidden for read actions instead of just filtering and warning on :debug.
However, if I break out the first policy into individual policies where action_type gets a single atom for action type instead of a list, no error is thrown and the filtering in my tests occur as previously expected:
I'd like to think that 3.7.0 wouldn't introduce a change in the policies logic but I'm very open to it providing improved implementations that catch any of my stupid mistakes ๐
A self-contained reproduction:
https://github.com/carlgleisner/policy_reproGitHub
GitHub - carlgleisner/policy_repro
Contribute to carlgleisner/policy_repro development by creating an account on GitHub.
7 Replies
@Carl can you update to 3.7.1 please?
I made the repro with 3.7.1 already ๐ซก
Actually this may just be a bug
Had a feeling but with respect to you I always assume it's on my end ๐
Okay, I have a lead
Luckily this particular issue would only ever lead to getting different kind of error on forbidden, not any kind of security issue
Solution
@Carl please try
mainConfirmed the fix and it works like a charm โ
Thanks Zach!
https://github.com/carlgleisner/policy_repro/commit/bb1084202f4847a41711e08b9ec79a4100e4b2fe