Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FTM: Add caching to ESContentFactoryImpl#findContentletByIdentifier to optimize queries with the publishDate parameter #31246

Open
Tracked by #30598
fabrizzio-dotCMS opened this issue Jan 27, 2025 · 2 comments · May be fixed by #31293

Comments

@fabrizzio-dotCMS
Copy link
Contributor

fabrizzio-dotCMS commented Jan 27, 2025

Parent Issue

No response

User Story

Currently, the method ESContentFactoryImpl#findContentletByIdentifier(final String identifier, final long languageId, final String variantId, final Date timeMachineDate) executes direct database queries when collections with the Time Machine feature are queried using the publishDate parameter set to a future date.

This behavior creates a vulnerability where malicious users could misuse URLs with the publishDate parameter to overload the database with unnecessary queries. To mitigate this risk, caching should be introduced for this method.

since FTM gets triggered by passing the publishDate param, add a condition to prevent FTM from getting triggered unless the publishDate is the present day including a specific time
if (publishDate == today && publishDate does not have time){
publishDate = null
}

Acceptance Criteria

•	The method leverages a caching mechanism to prevent repeated direct queries to the database.
•	The cache is invalidated automatically when changes occur to the page structure (e.g., content updates, page deletions, or publishing actions).
•	Performance improvements are observed during testing, particularly when multiple queries use the publishDate parameter with similar configurations.

Proposed Objective

Security & Privacy

Proposed Priority

Please Select

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

No response

Assumptions & Initiation Needs

No response

Quality Assurance Notes & Workarounds

No response

Sub-Tasks & Estimates

No response

@fabrizzio-dotCMS fabrizzio-dotCMS changed the title Add caching to ESContentFactoryImpl#findContentletByIdentifier to optimize queries with the publishDate parameter FTM: Add caching to ESContentFactoryImpl#findContentletByIdentifier to optimize queries with the publishDate parameter Jan 27, 2025
@nollymar nollymar removed the Triage label Jan 27, 2025
@nollymar nollymar moved this from New to Next 1-3 Sprints in dotCMS - Product Planning Jan 27, 2025
@fabrizzio-dotCMS fabrizzio-dotCMS moved this from Next 1-3 Sprints to Current Sprint Backlog in dotCMS - Product Planning Jan 29, 2025
@fabrizzio-dotCMS fabrizzio-dotCMS self-assigned this Jan 29, 2025
@fabrizzio-dotCMS fabrizzio-dotCMS moved this from Current Sprint Backlog to In Progress in dotCMS - Product Planning Jan 30, 2025
fabrizzio-dotCMS added a commit that referenced this issue Jan 31, 2025
fabrizzio-dotCMS added a commit that referenced this issue Feb 3, 2025
@nollymar
Copy link
Contributor

nollymar commented Feb 12, 2025

Now with FTM, each time we request a page in Live Mode, we are always sending a publish date. Please make sure we are not executing the logic related to FTM when the publish date/time is now . Consider a time lapse (I suggest 1-2 mins) in case there is a delay in the request

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Current Sprint Backlog
Development

Successfully merging a pull request may close this issue.

3 participants