dotCMS / dotCMS/core

[Task] Add license check (STANDARD minimum) to /api/es/search and /api/es/raw

Open Beginner friendly
#35,385 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Context

This task was filed as part of the backend API audit spike #35369 (child of #34733).

Problem

render.jsp (line 35) enforces LicenseLevel.STANDARD minimum before rendering the ES Search portlet UI. However, the REST endpoints POST /api/es/search and POST /api/es/raw in ESContentResourcePortlet.java perform no license check. An authenticated API client can call these endpoints directly regardless of the instance's license level.

File

dotCMS/src/main/java/com/dotcms/rest/elasticsearch/ESContentResourcePortlet.java

Expected behavior

Both POST /api/es/search and POST /api/es/raw should return HTTP 402 when the instance license level is below LicenseLevel.STANDARD, matching the portlet gate in render.jsp.

Implementation notes

  • Use LicenseUtil.getLevel() and compare against LicenseLevel.STANDARD.level (same pattern as render.jsp:35)
  • Return Response.status(402).entity("...license required...").build() early
  • This is a behavior change — no annotation-only fix possible
  • The 402 response is already documented in the OpenAPI spec (added in #35369 spike)

Out of scope

  • Do NOT change behavior of the GET variants (they are @Hidden and excluded from the public spec)
  • Do NOT change any other endpoint behavior

Parent issues

  • Audit spike: #35369
  • BE API umbrella: #34292
  • Epic: #34733

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 dotCMS/src/main/java/com/dotcms/rest/elasticsearch/ESContentResourcePortlet.java and compare the endpoint flow with the LicenseUtil.getLevel() gate in render.jsp. Confirm that POST /api/es/search and POST /api/es/raw return HTTP 402 below LicenseLevel.STANDARD, while GET variants and other endpoint behavior remain unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api, authorization
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
75/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.