Short-lived permission cache ignores its 60s TTL and isn't cleared on permission save or publish: a transient "deny" persists until Flush All Caches
Los mantenedores suelen responder en 2 días
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 52/100
Línea de trabajo
Start with PermissionBitAPIImpl.doesUserHavePermission(), PermissionCacheImpl.putUserHavePermission(), and CaffineCache.put() to trace how the short-lived entry gets its TTL. Then inspect the permission-save and contentlet/Site publish paths named in the issue, along with their cluster invalidation messages. Add integration coverage for TTL expiry and invalidation after commit on all nodes; done means each acceptance criterion passes, including the existing flush behavior.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Problem Statement
PermissionBitAPIImpl.doesUserHavePermission() caches every yes/no permission decision in the PermissionShortLived cache group. The group is configured to keep each decision for 60 seconds:
## Cache doesUserHavePermission calls for 60 seconds
cache.permissionshortlived.seconds=60
cache.permissionshortlived.size=100000
Two defects mean a single wrong decision, including a transient "deny", is kept indefinitely on the node that computed it:
1. The 60-second TTL is never applied.
PermissionCacheImpl.putUserHavePermission()stores the decision withcache.put(key, hasPermission, shortLivedGroup)(PermissionCacheImpl.java:155on main).- That call reaches
CaffineCache.put(group, key, content), which callsput(group, key, content, Long.MAX_VALUE)(CaffineCache.java:97-98). DynamicTTLCacheuses the TTL stored with each entry (expireAfterCreatereturnsvalue.getTtlInMillis()). The group default built fromcache.permissionshortlived.secondsis used only byDynamicTTLCache.put(key, value), which this path never calls.- So entries never expire. They are removed only by size eviction (100,000 entries) or by a flush of the group.
2. Nothing that changes the inputs to the decision clears it.
On main, flushShortTermCache() is called only from RoleFactoryImpl (L338 and L458): role grant, role revoke and role-tree moves (#35458, #38521). None of the following clear the cached decisions:
- saving, resetting or cascading permissions on an asset (
PermissionBitFactoryImpl.savePermission/assignPermissions,RoleAjax.saveRolePermission,PermissionAjax.saveAssetPermissions,PUT /api/v1/permissions/...). These evict only the primaryPermissionCacheentry for the asset; - saving, publishing or unpublishing a contentlet or Site. The anonymous READ decision depends on whether the asset is live (
PermissionBitAPIImplchecksisLiveContentlet()for the CMS Anonymous role); - the cluster cache invalidation messages that other nodes receive for those changes.
Because respectFrontendRoles is part of the key, anonymous and front-end traffic is hit hardest: one cached false for (asset, READ, anonymous, true) denies every anonymous request for that asset on that node.
#35458 (first in v26.11.11-01) made "Flush Permission Cache" (PermissionCacheImpl.clearCache()) also flush shortLivedGroup. On older versions, including 24.12 LTS, only Flush All Caches clears these decisions.
Production impact (Freshdesk #41409, 24.12.27 LTS, 2 nodes on Kubernetes)
- Both nodes restarted at 05:05 UTC after a deployment.
- 05:06:13: a deployment step saved and published a Site record on node B.
- 05:06:14.984, about 1.7 s later: node A still saw the Site as not live (its cached Site and version info briefly disagreed during cross-node invalidation). It logged:
WARN business.PermissionBitAPIImpl - User 'anonymous' cannot verify READ permissions on Contentlet '<site-id>' because it is not live. ERROR business.HostAPIImpl - User 'null' does not have READ permissions on Site '<site>' - Node A cached that
false. Every anonymous request to the Site on node A was denied for the next 43 minutes, including all$webapi.getAssetPath("//<site>/application/config/...")calls in/api/vtl/*endpoints, which then returned empty responses. Node B, which had cachedtrue, served the same requests normally, so clients saw intermittent failures. - Re-saving CMS Anonymous permissions on the Site (on node A) had no effect. Only Flush All Caches resolved it.
- The "not live" warning is logged only when the decision is computed, not on cache hits. After the first request there was no log trail explaining the denials.
The DB grant (CMS Anonymous READ on the Site, individual permission) was present throughout. The transient "not live" window is expected to self-correct within milliseconds. It became an outage only because the decision was cached with no expiry.
Steps to Reproduce
A. Single node: the TTL is ignored and a permission save doesn't clear the decision
- Create a Site or folder with a file under it, and make sure CMS Anonymous does not have READ on it.
- As an anonymous user, request the file, or call a VTL/page that resolves it with
$webapi.getAssetPath("//<site>/<path>"). The request is denied, anddoes not have READ permissionsis logged. - As an admin, grant CMS Anonymous READ on the Site or folder (Permissions tab → Save, or Roles → Permissions with cascade).
- Wait more than 60 seconds (longer than
cache.permissionshortlived.seconds). - Repeat the anonymous request.
Expected: allowed after the save, or at most 60 seconds later.
Actual: still denied indefinitely. It is fixed only by Flush All Caches (or "Flush Permission Cache" on versions that include #35458).
B. Cluster: a Site publish poisons another node
- Run two nodes behind a load balancer. CMS Anonymous has READ on Site X.
- Keep anonymous traffic going to both nodes for an endpoint that reads Site X (for example a
/api/vtl/*endpoint calling$webapi.getAssetPath("//X/...")). - On node B, edit and publish the Site X record (Sites → Edit → Save/Publish).
- Within about 2 seconds, send an anonymous request for Site X directly to node A, for example with
kubectl port-forward.
Expected: at most a momentary denial that clears within 60 seconds.
Actual: if node A computes the decision while it still sees Site X as not live, it logs the cannot verify READ ... because it is not live warning once, then denies all anonymous requests for Site X until Flush All Caches. Node B is unaffected.
Note: B depends on timing and may need several attempts. A is deterministic and shows the core defect on its own.
Acceptance Criteria
- Entries in
PermissionShortLivedexpire aftercache.permissionshortlived.seconds(default 60). A cachedfalsestops being served within that window without any manual flush. - Saving, resetting or cascading permissions on an asset invalidates the cached decisions for that asset, after the transaction commits, on all cluster nodes. A request repeated immediately after the save reflects the new permissions.
- Saving, publishing, unpublishing, archiving or deleting a contentlet or Site invalidates the cached decisions for that asset on all nodes, so a transient "not live" decision cannot outlive the publish.
- "Flush Permission Cache" continues to clear the short-lived decisions (regression guard for #35458).
- Integration tests cover:
- expiry after the configured TTL;
- invalidation on permission save, run after commit, not inside the transaction;
- invalidation on contentlet/Site publish.
- Optional: log at DEBUG, or rate-limited WARN, when a cached
falseis served for CMS Anonymous on a Site, so a stuck denial leaves a trail.
dotCMS Version
Reported on 24.12.27 LTS v15.
- Confirmed by code review on
main@245acad(2026-11-16): defects 1 and 2 are both still present.
Severity
High - Major functionality broken
Links
Freshdesk: #41409
- Related: #34467 ("Cache Not Flushed After User Permission Update", open): likely the same missing clear-on-save
- Related: #35458 (merged):
clearCache()now flushesshortLivedGroup; role grant/revoke flush it after commit. Origin: private-issues#567 - Related: #38521 (merged): flushes short-lived decisions on role-tree moves
- Related, different path: #35680 / #35684 (merged): an empty permission list cached in the primary
PermissionCacheduring push publishing
- Lenguaje dominante
- Java
- Estrellas
- 972
- Forks
- 493
- Merge medio
- 2 d 12 h
- PR fusionados (30 d)
- 228
Preparar el entorno
Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de dotCMS/core
-
dotCMS : UVE OKR : Customer Support Team : Maintenance Type : Defect
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Los mantenedores suelen responder en 2 días
-
OKR : Customer Support Team : Maintenance Type : Defect
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 2 días
-
Opening content from Content Search replaces the "Search" breadcrumb in the new Edit Content screenAbiertodotCMS: New Edit Contentlet OKR : Customer Support Team : Falcon Type : Defect
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 2 días
-
Escape the Binary field hint in the legacy content editor so an apostrophe doesn't break the fieldAbiertoOKR : Customer Support Team : Maintenance Type : Defect
Dificultad 2/5 1-3 horas Aptitud para principiantes 79/100
Los mantenedores suelen responder en 2 días
-
dotCMS : Permissions OKR : Customer Support Team : Maintenance Type : Defect
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Los mantenedores suelen responder en 2 días
Todos los issues de dotCMS/core
Issues similares
-
desktop grp:about type:graphics-bug ui-public
Dificultad 1/5 Menos de una hora Aptitud para principiantes 68/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
Los mantenedores suelen responder en 2 días
-
enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
it-at-m/Wahllokalsystem#3846 ·
Los mantenedores suelen responder en 2 días
-
Area/Connector module/solace Priority/Low Type/Bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 77/100
ballerina-platform/ballerina-library#9849 ·
Los mantenedores suelen responder en 1 día