Skip to content

Fix unauthorized field exposure in asset responses#25905

Merged
AlexGaillard merged 55 commits intomainfrom
gaetan/cms-819-filename-for-assets-is-exposed-even-when-access-policy
Jan 12, 2026
Merged

Fix unauthorized field exposure in asset responses#25905
AlexGaillard merged 55 commits intomainfrom
gaetan/cms-819-filename-for-assets-is-exposed-even-when-access-policy

Conversation

@gaetansenn
Copy link
Contributor

@gaetansenn gaetansenn commented Sep 26, 2025

Scope

What's changed:

  • AssetsService now respects field-level permissions when serving assets
  • Introduced returnAllowedRootFields option in validateItemAccess to retrieve accessible fields in a single database query
  • Fields restricted by user permissions (e.g., filename_download, modified_on) are filtered from the response and HTTP headers

Potential Risks / Drawbacks

  • None - essential fields are preserved, and the implementation is backward compatible

Tested Scenarios

  • Field filtering for non-admin users with field-level restrictions
  • Admin users retain full access to all fields
  • Item-level permission rules combined with field-level permissions
  • System public assets bypass filtering correctly

Checklist

  • Added or updated tests
  • Documentation PR created here or not required

Fixes #24057

@gaetansenn gaetansenn requested a review from a team as a code owner September 26, 2025 15:36
@linear
Copy link

linear bot commented Sep 26, 2025

Copy link
Member

@ComfortablyCoding ComfortablyCoding left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately the current approach leads to a few issues:

  • It introduces a breaking change by requiring explicit permission for fields that are essential
  • There's no clear guidance on which fields are minimally required
  • It forces users to grant access to fields they wouldn’t typically allow

Ideally we have a way to query as an admin but return the data as the if the user queried

Copy link
Member

@br41nslug br41nslug left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got some type nitpicks for you 😬 hopefully those get rid of some reliance on the any type.

Will have to look at this again with some fresh eyes to properly wrap my head around the fix here 😵

@gaetansenn gaetansenn changed the title Gaetan/cms 819 filename for assets is exposed even when access policy Fix unauthorized field exposure in asset responses Dec 1, 2025
@ComfortablyCoding ComfortablyCoding self-assigned this Dec 2, 2025
@ComfortablyCoding ComfortablyCoding self-requested a review December 2, 2025 14:04
@ComfortablyCoding ComfortablyCoding self-requested a review December 19, 2025 17:41
@AlexGaillard AlexGaillard merged commit f6bfc5e into main Jan 12, 2026
75 checks passed
@AlexGaillard AlexGaillard deleted the gaetan/cms-819-filename-for-assets-is-exposed-even-when-access-policy branch January 12, 2026 08:11
@github-actions github-actions bot added this to the Next Release milestone Jan 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Filename for assets is exposed even when access policy denies access to "filename_download" field

4 participants