Repository navigation
fix(graphql): default args.data and fix buildPolicyType global name - #19155
Vedant1442 wants to merge 1 commit into
Conversation
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Global update and policy type corrections packages/graphql/src/resolvers/globals/update.ts, packages/graphql/src/schema/buildPoliciesType.ts |
The update resolver defaults nullish data to {} and includes added documentation. The policy type name uses entity instead of global, retaining the slug fallback and suffix. Added documentation describes buildPolicyType. |
Priority:
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix · Severity of issue fixed: Medium
Possibly related PRs
- payloadcms/payload#19077: Implements the same resolver and policy type fixes.
- payloadcms/payload#19075: Implements the same fixes and adds regression tests for omitted update data and entity-based policy type names.
- payloadcms/payload#18862: Changes hidden-field mutation input generation and includes related resolver and policy-type fixes.
Suggested reviewers: danribbens
Merge Risk: 
Minimal · up to 19c18
-
No merge-blocking issue is established for these GraphQL global fixes; merge after normal validation.
Security architecture risk: 
Low · up to 3ec8e
-
The changes are narrowly scoped. Updates without generated input now follow the existing authorization and update lifecycle, while policy type names use the configured global name. No authorization bypass was demonstrated, but these updates can still trigger writes, versions, and application hooks.
Retained concerns
No architecture-level concerns identified.Security review details
-
Security Blast Radius
- inferred — The newly successful omitted-data path is bounded by globals whose GraphQL mutations are enabled and whose schema has no generated update input. It can reach the ordinary write, version, and hook lifecycle for that configured global; it does not introduce caller-selected global identities or new service authority.
Security Findings and Attack Paths
- inferred — No authorization bypass was demonstrated for the newly admitted empty update. Caller-controlled omission changes the data supplied to the existing operation, but does not remove global authorization or field processing. Deployment-specific policies can distinguish an empty object from missing data, so their behavior remains outside this conclusion.
Trust Boundaries and Controls
- observed — The GraphQL mutation does not expose publishAllLocales or unpublishAllLocales. Within the existing operation, localized publication intent is checked against field access and the processed status value before publication handling.
Resilience and Maintainability Implications
- observed — The existing operation initializes its transaction inside a try block, commits when it owns the transaction after writes and hooks finish, and invokes transaction cleanup on caught errors. This establishes the cleanup control flow, not atomic rollback of arbitrary application-hook side effects or every database configuration.
-
Pre-merge checks: 
5
-
Full details: Linked Issues check
-
Explanation
Issue
#19067has two coding requirements. The update resolver now passesargs.data ?? {}toupdateOperationGlobal.buildPolicyTypenow computes the global name fromentity?.graphQL?.name || slug. These changes satisfy both requirements. The issue suggests a test but does not require one.
Full details: Out of Scope Changes check
-
Explanation
The reported changes are limited to the two fixes in issue
#19067. The added comments document the affected code and support the implementation. No unrelated production changes, tests, documentation, or refactoring are identified.
Full details: Docstring Coverage
-
Explanation
Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 1 functions across 2 files.
-
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.
3ec8ea7 to
19c1848
Compare
Fixes #19067. Two small fixes: 1) globals update resolver now defaults args.data to {} (matching collections create/update) to avoid MissingGlobalData when all fields are hidden. 2) buildPolicyType uses the destructured entity instead of Node's global when computing globalTypeName.