rapidfsub
policies do
policy action_type(:read) do
forbid_if expr(type(true, :boolean))
authorize_if always()
end
end
I think forbid_if expr(type(true, :boolean)) is an inline filter policy,
so Ash.read!(ResourceModule) should return [],
but it raises an error.
** (Ash.Error.Forbidden) Forbidden Error
* forbidden
(elixir 1.17.0) lib/process.ex:864: Process.info/2
(ash 3.4.1) lib/ash/error/forbidden/policy.ex:9: Ash.Error.Forbidden.Policy."exception (overridable 2)"/1
(ash 3.4.1) lib/ash/error/forbidden/policy.ex:28: Ash.Error.Forbidden.Policy.exception/1
(ash 3.4.1) lib/ash/policy/authorizer/authorizer.ex:1529: Ash.Policy.Authorizer.strict_check_result/2
(ash 3.4.1) lib/ash/policy/authorizer/authorizer.ex:617: Ash.Policy.Authorizer.strict_check/2
(ash 3.4.1) lib/ash/can.ex:412: anonymous fn/6 in Ash.Can.run_check/4
(elixir 1.17.0) lib/enum.ex:4858: Enumerable.List.reduce/3
(elixir 1.17.0) lib/enum.ex:2585: Enum.reduce_while/3
(ash 3.4.1) lib/ash/can.ex:409: Ash.Can.run_check/4
(ash 3.4.1) lib/ash/can.ex:118: Ash.Can.can/4
(ash 3.4.1) lib/ash.ex:1283: Ash.can/3
(ash 3.4.1) lib/ash/actions/read/read.ex:1163: Ash.Actions.Read.authorize_query/2
(ash 3.4.1) lib/ash/actions/read/read.ex:365: Ash.Actions.Read.do_read/4
(ash 3.4.1) lib/ash/actions/read/read.ex:249: Ash.Actions.Read.do_run/3
(ash 3.4.1) lib/ash/actions/read/read.ex:66: anonymous fn/3 in Ash.Actions.Read.run/3
(ash 3.4.1) lib/ash/actions/read/read.ex:65: Ash.Actions.Read.run/3
(ash 3.4.1) lib/ash.ex:1887: Ash.read/2
(ash 3.4.1) lib/ash.ex:1846: Ash.read!/2
(elixir 1.17.0) src/elixir.erl:386: :elixir.eval_external_handler/3
(stdlib 6.0) erl_eval.erl:904: :erl_eval.do_apply/7
(elixir 1.17.0) lib/process.ex:864: Process.info/2
(ash 3.4.1) lib/ash/error/forbidden.ex:3: Ash.Error.Forbidden.exception/1
(ash 3.4.1) /Users/r4f3works/fireworks/r3world/deps/splode/lib/splode.ex:211: Ash.Error.to_class/2
(ash 3.4.1) lib/ash/error/error.ex:66: Ash.Error.to_error_class/2
(ash 3.4.1) lib/ash/actions/read/read.ex:340: anonymous fn/3 in Ash.Actions.Read.do_run/3
(ash 3.4.1) lib/ash/actions/read/read.ex:265: Ash.Actions.Read.do_run/3
(ash 3.4.1) lib/ash/actions/read/read.ex:66: anonymous fn/3 in Ash.Actions.Read.run/3
(ash 3.4.1) lib/ash/actions/read/read.ex:65: Ash.Actions.Read.run/3
(ash 3.4.1) lib/ash.ex:1887: Ash.read/2
(ash 3.4.1) lib/ash.ex:1846: Ash.read!/2
iex:6: (file)
Is this an intended behavior?
Trending in Questions
Hello!
Suppose you are building workflow (order / task / payment) processing system with the following requirements:
Each workflow con...
New
Hey guys,
I’ve got a huge CSV ( around 10 GB ) that needs to be processed hourly
Do you guys have any suggestions what is the best prac...
New
Kia ora,
We have been using elixir-google-api to connect to Google Drive. However, with the updates to Tesla due to CVEs this is now bro...
New
Hello!
Could someone please give me a help/sample code, how to delete a file from s3 using waffle/waffle_ecto from Phoenix app.
I creat...
New
I have what I’ve heard referred to as a “lookup table” in my database. This is a way of assigning codes to common values. One common lo...
New
Hello,
I’m developing a online persistent chat system (what’s app) like using elixir/dynamodb/aws for a mobile app(flutter).
The diffic...
New
What approach to take when sending live updates to “random” users Hi! I have a question, I have a little chat app, and when I create a DM...
New
Other Trending Topics
Hobbes is a low-level distributed database for the Elixir programming language.
Hobbes provides a simple, safe, and scalable storage lay...
New
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve.
They are GUI (Emerge) and State management (S...
New
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
There are three potential reasons for members of this forum to have a look at https://vutuv.de
You are tired or annoyed of LinkedIn.
Yo...
New
ICal is a library for interacting with iCalendar data. It parses iCalendars into typed Elixir structs via ICal.from_ics, and can prepare ...
New
Latest Ash Threads
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #blog-post
- #ai
- #phoenix_html
- #elixirconf-us
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming










Showing Posts 1 to 10- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
zachdaniel
i.e
forbid_if trueis immediately incorrect, no queries must be made.rapidfsub
But I think the behavior of FilterPolicy should be predictable.
In some cases,
raise errorand in other cases,query and filterconfuses me.If I write a complex inline FilterPolicy,
something like
expr(<statically determinable clause> and <dynamically determinable clause> and ...)then this could be so hard to predict the result. @zachdaniel
zachdaniel
…yes. You’re right. I’ll look into it.
zachdaniel
@rapidfsub I’ve pushed something up to main that should make this consistent with the only exception of
which will still be a static failure.
zachdaniel
Okay, so this is actually going to have to be opt-in behavior so as to be backwards compatible. On the new version of Ash, you’d say:
rapidfsub
In the future (e.g. ash 4.0), this would be a default behaviour?
zachdaniel
Yes, it would be
rapidfsub
Sorry for late feedback.
I was focused on other things.
Now I started to use
config :ash, policies: [no_filter_static_forbidden_reads?: false].And I found SimpleCheck also does not raise error in read action.
But I think only FilterCheck should not raise error,
and SimpleCheck “should” raise error.
If not, we can’t forbid read actions “at all”.
zachdaniel
You can forbid read actions, the way you do it is by marking a policy as
access_type :strictrapidfsub
Thanks. I should have read the updated policy docs.