Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attributes are ignored for read actions in controller helpers #865

Open
afn opened this issue Sep 13, 2024 · 0 comments
Open

Attributes are ignored for read actions in controller helpers #865

afn opened this issue Sep 13, 2024 · 0 comments

Comments

@afn
Copy link

afn commented Sep 13, 2024

Steps to reproduce

It appears that the attributes passed to can are only used by ControllerResourceBuilder but not by ControllerResourceFinder, so restrictions on accessible attributes are not automatically applied to #index and #show actions.

See gist: https://gist.github.com/afn/441dfcf4ddc751b82f09af11bb356ba2

Expected behavior

When Ability restricts access to attributes on a :read action, the controller helpers for #index and #show should automatically select only the subset of attributes that are permitted.

Actual behavior

The resources assigned by load_and_authorize_resource include all attributes of the model, even ones that should not be accessible

System configuration

Rails version: 7.1

Ruby version: 3.3.2

CanCanCan version: 3.5.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant