dotCMS / dotCMS/core

GraphQl Caching issue

Open
#30,319 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

OKR : Customer Support Priority : 2 High Team : Maintenance Type : Defect
Dominant language
Java
Stars
970
Forks
486
Avg merge
3d 33m
Merged PRs (30d)
170

Description

Parent Issue

No response

Problem Statement

When CACHEGRAPHQLQUERYCACHESIZE has been set other than 0 e.g CACHE_GRAPHQLQUERYCACHE_SIZE=5000
so it is possible that when a graphql endpoint hits after a user has logged out, so content is received for unauthenticated users, and when a user logs in, then expected content doesn't return for an authenticated user.

However when setting DOTCACHEGRAPHQLQUERYCACHE_SIZE=0 fix this issue but it has own cost so every query bypass the cache and hits the database.

Steps to Reproduce
  1. User logs in
  2. Authenticated content is returned via graphql query as expected
  3. User logs out
  4. Authenticated content is returned via graphql query and this is not expected
Acceptance Criteria

The query should return results according to user authorization.

dotCMS Version

24.* - ALL

Proposed Objective

Customer Support

Proposed Priority

Priority 2 - Important

External Links... Slack Conversations, Support Tickets, Figma Designs, etc.

The possible solution would be to add the user ID to the hash to store the GraphQL results, so the cache will have permission results correctly.

https://dotcms.slack.com/archives/CSHTYUR7H/p1728482860368219?thread\_ts=1728479700.752749&cid=CSHTYUR7H

https://dotcms.freshdesk.com/a/tickets/27968

Assumptions & Initiation Needs

No response

Quality Assurance Notes & Workarounds

No response

Sub-Tasks & Estimates

No response

Contributor guide

Open the contributing guide

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.

Research direction

Start by tracing the GraphQL query cache and its authorization context with CACHE_GRAPHQLQUERYCACHE_SIZE set to a nonzero value. Reproduce the login, logout, and login sequence, then verify that cached results follow the requesting user's authorization without requiring the cache to be disabled.

Written by the indexing model from the issue text.

Assessment

Tech stack
graphql, java
Domain
api, authentication, authorization, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.