Skip to content

fix(authorization): return null data and respect error location config for fully-unauthorized requests#9022

Merged
carodewig merged 25 commits intodevfrom
caroline/router-1569
Mar 18, 2026
Merged

fix(authorization): return null data and respect error location config for fully-unauthorized requests#9022
carodewig merged 25 commits intodevfrom
caroline/router-1569

Conversation

@carodewig
Copy link
Copy Markdown
Contributor

@carodewig carodewig commented Mar 17, 2026

When the query planner rejects a request because all fields are unauthorized, the response was always returned with errors in the errors array and data: {} — ignoring the configured errors.response location and returning an empty object instead of null.

This fix makes fully-unauthorized requests go through the same error formatting path as partially-unauthorized ones, so the errors.response and errors.log configuration is respected consistently. It also corrects the response to return data: null instead of data: {}.

The shared logic is consolidated into methods on UnauthorizedPaths, replacing duplicated inline implementations in both execution/service.rs and query_planner_service.rs.


Checklist

Complete the checklist (and note appropriate exceptions) before the PR is marked ready-for-review.

  • PR description explains the motivation for the change and relevant context for reviewing
  • PR description links appropriate GitHub/Jira tickets (creating when necessary)
  • Changeset is included for user-facing changes
  • Changes are compatible1
  • Documentation2 completed
  • Performance impact assessed and acceptable
  • Metrics and logs are added3 and documented
  • Tests added and passing4
    • Unit tests
    • Integration tests
    • Manual tests, as necessary

Exceptions

Note any exceptions here

Notes

Footnotes

  1. It may be appropriate to bring upcoming changes to the attention of other (impacted) groups. Please endeavour to do this before seeking PR approval. The mechanism for doing this will vary considerably, so use your judgement as to how and when to do this.

  2. Configuration is an important part of many changes. Where applicable please try to document configuration examples.

  3. A lot of (if not most) features benefit from built-in observability and debug-level logs. Please read this guidance on metrics best-practices.

  4. Tick whichever testing boxes are applicable. If you are adding Manual Tests, please document the manual testing (extensively) in the Exceptions.

@carodewig carodewig requested a review from a team as a code owner March 17, 2026 16:44
@apollo-librarian
Copy link
Copy Markdown
Contributor

apollo-librarian bot commented Mar 17, 2026

✅ Docs preview ready

The preview is ready to be viewed. View the preview

File Changes

0 new, 1 changed, 0 removed
* graphos/routing/(latest)/security/authorization.mdx

Build ID: 748f7ff34a0bce521d758871
Build Logs: View logs

URL: https://www.apollographql.com/docs/deploy-preview/748f7ff34a0bce521d758871


⚠️ AI Style Review — 2 Issues Found

Summary

This pull request updates the documentation to align with several style guide standards. Key changes include reframing content to be organization-centric and adopting a more authoritative voice by removing unopinionated phrasing like 'for your needs.' Technical accuracy was improved by applying active voice to clarify router actions and removing definite articles before standalone product names such as 'Router.' Additionally, formatting and word usage were refined by removing italics for general emphasis and replacing the term 'below' with 'following' in body text.

Duration: 2884ms
Review Log: View detailed log

This review is AI-generated. Please use common sense when accepting these suggestions, as they may not always be accurate or appropriate for your specific context.

@github-actions

This comment has been minimized.

carodewig and others added 6 commits March 17, 2026 12:49
Applied suggestions from AI review 20260317-911566dd-9022-fc0e624187928c55:
- docs/source/routing/security/authorization.mdx:384: Do not use articles before standalone product names like Router.; Do not use ita...
- docs/source/routing/security/authorization.mdx:923: Use the reader-centric 'you' instead of passive voice to make the instruction mo...

Review: #9022
Triggered by: caroline.rodewig@apollographql.com
Copy link
Copy Markdown
Contributor

@conwuegb conwuegb left a comment

Choose a reason for hiding this comment

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

LGTM

Comment thread docs/source/routing/security/authorization.mdx Outdated
@carodewig carodewig enabled auto-merge (squash) March 18, 2026 13:41
@carodewig carodewig merged commit e9071bb into dev Mar 18, 2026
15 checks passed
@carodewig carodewig deleted the caroline/router-1569 branch March 18, 2026 14:12
@abernix abernix mentioned this pull request Mar 31, 2026
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

Successfully merging this pull request may close these issues.

2 participants