Skip to content

fix(urlmap): use configured detail page when not found on requesting site (#35268)#36000

Merged
dsilvam merged 1 commit into
mainfrom
issue-35268-urlmap-detail-page-host
Jun 6, 2026
Merged

fix(urlmap): use configured detail page when not found on requesting site (#35268)#36000
dsilvam merged 1 commit into
mainfrom
issue-35268-urlmap-detail-page-host

Conversation

@dsilvam
Copy link
Copy Markdown
Member

@dsilvam dsilvam commented Jun 5, 2026

Proposed Changes

  • In URLMapAPIImpl.getDetailPageUri(), when the configured detail page lives on a different host (e.g. //global/) and no matching path exists on the requesting site, fall back to the configured identifier instead of returning Optional.empty().

Root Cause

The runtime URL map flow has two steps:

  1. buildContentQuery() — finds the URL-mapped contentlet via ES, restricted to +(conhost:<currentSite> OR conhost:SYSTEM_HOST)
  2. getDetailPageUri() — resolves the rendering page from the content type's detailPage identifier

Step 2 correctly handles the case where the detail page is on the current host. When it isn't, it tries to find a page at the same path on the current host. If nothing is found (e.g. the page is on //global/), it was returning Optional.empty() → 404. The fix returns the configured identifier directly as a safe fallback.

Content host isolation is fully preserved — only step 1 determines which contentlet is returned, and that query is never modified.

This restores the targeted getDetailPageUri() fallback that was reverted in #35622 alongside the unsafe cross-site ES query change. The unsafe buildContentQuery() change is not reintroduced.

Checklist

  • Tests — processURLMap_detailPageOnDifferentHost_shouldResolveWithConfiguredDetailPage added to URLMapAPIImplTest; existing cross-site bleed guard processURLMap_mustNotReturnContentFromForeignHost_whenRequestingHostHasNoMatch still passes
  • Translations
  • Security Implications Contemplated — detail page is admin-configured (not user-supplied); content query host restriction unchanged

Additional Info

Closes #35268

This PR fixes: #35268

…site (#35268)

When the detail page is configured on a different host (e.g. //global/),
fall back to the configured identifier instead of returning empty and
producing a 404. Content host isolation is preserved — buildContentQuery()
still restricts content to the current site and SYSTEM_HOST.

Refs: #35268

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@claude
Copy link
Copy Markdown
Contributor

claude Bot commented Jun 5, 2026

Claude finished @dsilvam's task in 2m 26s —— View job


dotCMS Backend Review Pipeline

  • Load dotCMS conventions (CLAUDE.md, Java standards, security principles)
  • Get Java diff
  • Run specialized sub-agent reviews (Security, Database, Java Standards, REST API)
  • Consolidate findings
  • Post backend review comment
  • Submit formal GitHub review (auto-approve blocked by GitHub permissions — manual approval required)

All four specialized reviewers (Security, Database, Java Standards, REST API) returned no findings.

The change is a targeted one-liner in URLMapAPIImpl.getDetailPageUri(): instead of returning Optional.empty() when no matching page exists at the same path on the requesting site, it now falls back to return Optional.of(identifier) (the admin-configured detail page). Content host isolation is not affected — buildContentQuery() still restricts the ES query to conhost:<currentSite> OR conhost:SYSTEM_HOST. The new integration test correctly validates both the happy path (detail page on a different host resolves) and the existing cross-site bleed guard.

Note: I'm unable to submit a formal GitHub review approval due to GitHub App permissions. You can find more information and potential workarounds in the FAQ.

@claude
Copy link
Copy Markdown
Contributor

claude Bot commented Jun 5, 2026

dotCMS Backend Review: no issues found.

@dsilvam dsilvam added this pull request to the merge queue Jun 6, 2026
Merged via the queue into main with commit 94fb755 Jun 6, 2026
59 checks passed
@dsilvam dsilvam deleted the issue-35268-urlmap-detail-page-host branch June 6, 2026 06:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI: Safe To Rollback Area : Backend PR changes Java/Maven backend code

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

URL mapping returns 404 at runtime when detail page uses custom Page content type (follow-up to #35149)

3 participants