#110602Prevent TypoScript-->Functions-->cache poisoning by Page-Preview
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>|
}
- Clear all caches
- Open visible Page-A in Frontend.
- Open hidden Page-B in Frontend.
- Open visible Page-C in Frontend: stdWrap timestamp is from Page-B, but should be of Page-A