Issue Bug Resolved

#110602Prevent TypoScript-->Functions-->cache poisoning by Page-Preview

Ayke Halder 09/02/26, 12:47 updated 10/05/26, 14:20

Description

How to prevent TypoScript—>Functions—>cache poisoning by Page-Preview?

Objects are stored via TypoScript cache by cache.key: https://docs.typo3.org/m/typo3/reference-typoscript/main/en-us/Functions/Cache.html
Editor opens a page preview with showHiddenPages = 1 / showHiddenRecords = 1 enabled: e.g. https://docs.typo3.org/c/typo3/cms-adminpanel/main/en-us/Configuration/Index.html#confval-admpanel-override

If cache for cache.key was empty, the cache is then filled with content from preview containing hidden pages or records.
Next a normal visitor opens a public page with integrated hidden content from cache.

E.g. the cache is used to store a mega-menu.
Normal visitor should never see hidden page entries in this mega menu.

So is this worth a fix by automatically adding an additional flag to cache.key in case:
aspect frontend.preview is set
showHiddenPages = 1 / showHiddenRecords = 1 is active

Or how do you circumvent this situation?

How to reproduce

page.80 = COA
page.80 {
  cache {
    key = coacurrenttimestamp
    lifetime = unlimited
  }
  10 = TEXT
  10 {
      data = date : U
      strftime = %H:%M:%S
      noTrimWrap = |<p>Cache-Test on COA already works: | </p>|
  }
}

page.90 = TEXT
page.90 {
  stdWrap.cache {
    key = stdwrapcurrenttimestamp
    lifetime = unlimited
  }
  data = date : U
  strftime = %H:%M:%S
  noTrimWrap = |<p>Cache-Test on stdWrap has issue #110602: | </p>|
}
  1. Clear all caches
  2. Open visible Page-A in Frontend.
  3. Open hidden Page-B in Frontend.
  4. Open visible Page-C in Frontend: stdWrap timestamp is from Page-B, but should be of Page-A

Reviews 3