Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Field afterRead hooks run even when field read access is denied

Open Beginner friendly
#18,331 1 comment 1 reaction 0 assignees View on GitHub

Maintainers usually reply within 1 day

@Arya125259 is already working on this.

Since Sep 27, 2026.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
78/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
typescript

Research direction

Start in packages/payload/src/fields/hooks/afterRead/promise.ts, especially lines 131-140 and 282-404, and follow the ordering of field hooks, hidden-field handling, and access checks. Reproduce the issue with a field-level read denial and an afterRead logger, then verify the hook no longer runs for denied or hidden fields while accessible fields still behave normally.

Written by the indexing model from the issue text.

Description

area: core Bug created-by: Contributor
Describe the Bug

Field afterRead hooks run before field-level access.read is checked. If access is denied, the hook's result is deleted right away, so expensive hooks (fetching, computing virtual fields) run for nothing.

Same for hidden: true fields: the value is removed first (L131-L140), but the hook still runs, with value: undefined, unless showHiddenFields is set.

Expected: skip afterRead hooks for fields the user can't read.

Link to the code that reproduces this issue

https://github.com/payloadcms/payload/blob/124b55a/packages/payload/src/fields/hooks/afterRead/promise.ts#L282-L404

Reproduction Steps
  1. Add a field with access: { read: () => false } and an afterRead hook that logs
  2. Read the doc without overrideAccess
  3. The hook logs, but the field is not in the response
Which area(s) are affected?

area: core

Environment Info
payload: 3.90.2 and main (4.0.0-canary.37)
Dominant language
TypeScript
Stars
45.5k
Forks
4.3k
Avg merge
1d 19h
Merged PRs (30d)
295

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from payloadcms/payload

All issues in payloadcms/payload

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.