dotCMS / dotCMS/core

Audit follow-up: Cached Contentlet instances mutated during relationship hydration

Open
#36,012 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

stale
Dominant language
Java
Stars
970
Forks
486
Avg merge
3d 33m
Merged PRs (30d)
170

Description

Parent epic: #36004

Finding

ContentUtils.addRelationships appears to mutate the Contentlet backing map in place via contentlet.getMap().putAll(...). The audit says cached contentlets are stored/returned by reference, so Story Block hydration can add request-scoped relationship/render keys to shared cached instances.

Report references: dotCMS/src/main/java/com/dotmarketing/portlets/contentlet/util/ContentUtils.java:844, ContentletCacheImpl around lines 75 and 91

Potential impact

Concurrent renders may pollute shared cached contentlets, causing nondeterministic rendered output and bloated cache entries under load.

Suggested validation

Render the same cached contentlet concurrently with different relationship/story-block hydration contexts and inspect cached map contents / output variation.

Possible fix

Operate on a defensive copy, for example new Contentlet(contentlet), before adding relationship/render attributes.

Caveat

This was AI-found by Claude from .scratch/audit/REPORT.md. Please perform secondary validation of correctness, severity, and value before actioning.

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 with ContentUtils.java around line 844 and inspect ContentletCacheImpl around lines 75 and 91 to verify whether cached Contentlet maps are shared by reference. Run the proposed concurrent hydration/render validation and inspect cached map contents and output variation; done means the mutation risk is confirmed or ruled out with coverage for the resulting behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.