Repository navigation
fix(graphql): default args.data to {} in global update resolver and use entity.graphQL.name in buildPolicyType - #19075
Conversation
…se entity.graphQL.name in buildPolicyType
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Global update and policy type naming packages/graphql/src/resolvers/globals/update.ts, packages/graphql/src/schema/buildPoliciesType.ts, test/graphql/hidden-fields.int.spec.ts |
The global update resolver passes an empty object when args.data is nullish. Global policy type names use the entity’s GraphQL name or slug, with the configured suffix. The regression test checks the type names and calls updateAllHiddenGlobal without arguments. |
Priority:
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix · Severity of issue fixed: Low
Possibly related PRs
- payloadcms/payload#18862: It addresses hidden-field GraphQL mutation inputs and empty updates, including related collection resolver behavior and policy type changes.
Suggested reviewers: jarrodmflesch
Merge Risk: 
Minimal · up to 29881
-
The GraphQL global fixes are covered by focused regression tests and present no identified merge-blocking risk.
Security architecture risk: 
Low · up to 29881
-
The update still uses the existing permission and persistence path, and no new security bypass was identified. Clients that refer to the former access-policy type names may need to change when upgrading or rolling back.
Retained concerns
- Low · architecture · inferred: For globals with a configured GraphQL name, clients that reference the former slug-derived access-policy type names will need to migrate; rolling back reverses those names again. This is a conditional public-schema compatibility risk, not an observed permission bypass.
Security review details
-
Security Blast Radius
- inferred — The newly accepted nullish-data request can reach a global update, including its write and hooks, but only through the configured global’s existing mutation and update-operation path. No new service, credential, or authority path appears in the full PR diff.
Security Findings and Attack Paths
- inferred — No PR-introduced authorization bypass was identified in the inspected empty-update path: normalization does not set overrideAccess, and the existing operation evaluates update access before retrieving or writing the global. This conclusion is limited to the inspected shared path.
Trust Boundaries and Controls
- observed — The mutation takes caller-supplied arguments but obtains the request from GraphQL context. The resolver supplies neither overrideAccess nor showHiddenFields; the update operation evaluates global access and performs a final afterRead with those options unset.
Resilience and Maintainability Implications
- inferred — Repeated empty updates can still invoke configured hooks and write timestamps; the PR does not change their implementation or the existing lock and transaction path. Adapter-specific concurrency guarantees and effects of application-specific hooks were not independently established.
Pre-merge checks: 
4 · 
1
-
Failed checks: 1 warning Passed checks: 4 passed-
Full details: Title check
-
Explanation
The title names the two changes in the PR: defaulting args.data to {} in the global update resolver, and using entity.graphQL.name in buildPolicyType. It is specific and matches the changeset and linked issue
#19067. Its length is long, but it still conveys the main change.
Full details: Description check
-
Explanation
The description states both fixes with file paths and line references. It explains the cause: omitted args.data throws MissingGlobalData, and the global reference resolves to Node's globalThis.global. It also notes the added regression test and links issue
#19067. It is related to the changeset.
Full details: Linked Issues check
-
Explanation
Issue
#19067requires two GraphQL fixes.packages/graphql/src/resolvers/globals/update.tsnow passes(args.data ?? {}) as anyto the global update operation.packages/graphql/src/schema/buildPoliciesType.tsnow derivesglobalTypeNamefromentity?.graphQL?.name || slug. The added test verifiesHiddenGlobalAccessandHiddenGlobalDocAccessand invokes the update resolver without arguments.
Full details: Out of Scope Changes check
-
Explanation
The pull request changes only the global update resolver, global policy type-name construction, and regression coverage for these behaviors. These changes directly support issue
#19067. No unrelated change is shown in the whole-pull-request diff.
-
-
Finishing Touches
-
🧪 Generate unit tests (beta)
-
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Comment @coderabbitai help to get the list of available commands.
What?
datato(args.data ?? {}) as anyinpackages/graphql/src/resolvers/globals/update.ts(matchingpackages/graphql/src/resolvers/collections/create.tsandupdate.ts).entity?.graphQL?.name || sluginstead ofglobal?.graphQL?.name || sluginpackages/graphql/src/schema/buildPoliciesType.ts(buildPolicyType).Why?
args.datais not provided to the globalupdateresolver, passingdata: undefinedtoupdateOperationGlobalthrowsMissingGlobalData. Collectioncreateandupdateresolvers already defaultargs.data ?? {}.buildPolicyType, the parameter is destructured asentity(const { type, entity, scope, typeSuffix } = args). Referencingglobal?.graphQL?.nameon line 220 read Node's ambientglobalThis.globalinstead of the global config'sgraphQL.name, causingglobalTypeNameto always fall back toslug(e.g.hidden_globalAccessinstead ofHiddenGlobalAccess).How?
packages/graphql/src/resolvers/globals/update.tsline 42 to passdata: (args.data ?? {}) as any.packages/graphql/src/schema/buildPoliciesType.tsline 220 to computeglobalTypeNamefromentity?.graphQL?.name || slug.test/graphql/hidden-fields.int.spec.ts.Fixes #19067