dotCMS / dotCMS/core

Audit follow-up: Page search can NPE when onlyLiveSites=true and host is unresolved

Open
#36,010 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

When onlyLiveSites=true, page search appears to call hosts.get(contentlet.getHost()).isLive() without checking whether the host lookup returned null.

Report reference: dotCMS/src/main/java/com/dotcms/rest/api/v1/page/PageResource.java:1288-1295

Potential impact

If a page/contentlet references a deleted, null, or otherwise unresolved host, the whole page-search picker may return 500 instead of excluding that page.

Suggested validation

Create or simulate a contentlet whose host cannot be resolved, then run page search with onlyLiveSites=true.

Possible fix

Null-check the host lookup and treat unresolved / non-live hosts as excluded, for example h != null && Try.of(h::isLive).getOrElse(false).

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 at dotCMS/src/main/java/com/dotcms/rest/api/v1/page/PageResource.java:1288-1295 and validate the reported host lookup behavior. Create or simulate a contentlet with an unresolved host, then run page search with onlyLiveSites=true. Done means unresolved or non-live hosts are excluded without the page-search picker returning a 500.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.