ToolbarController::preRenderGetRenderedSubtrees() instantiates a new $cacheability variable which it populates in a loop and then applies to the parent render array. The problem is that this new instance does not have the parent's cacheability and therefore might delete crucial cache contexts.
Instead of using a blank CaheableMetadata, an instance should be created from the parent render array like so:
$cacheability = CacheableMetadata::createFromRenderArray($data);
Marking as major because in some edge cases I can't come up with this might lead to data exposure. Not filing as a security issue because 8.8.0 isn't out yet.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | drupal-3082032-2.patch | 1.15 KB | kristiaanvandeneynde |
Comments
Comment #2
kristiaanvandeneyndeThis was discovered as part of #2551419-149: Abstract RenderCache into a separate service that is capable of cache redirects in a non-render array-specific way where fixing this made 37 failing tests go green.
Comment #3
nickdickinsonwildeLooks good to me and the testbot.
Comment #4
alexpottIf this is a major bug fix then we need tests to prove we've fixed it and don't break it in the future.
Comment #11
borisson_Tagged with needs tests to make it clear that we're waiting for tests (as mentioned in #4)
Comment #13
catchIf #2551419: Abstract RenderCache into a separate service that is capable of cache redirects in a non-render array-specific way causes test failures without this, then that might be enough for test coverage.
Comment #14
kristiaanvandeneyndeRe #13: As #2 indicates, that seems to be the case.
Comment #15
catchLet's see what @alexpott thinks four years later.
Comment #16
larowlanPer #15
Comment #17
alexpottSure lets do this. There can't really be any harm.
Committed and pushed 2fe6ae3dd2 to 10.1.x and efc9b3f479 to 10.0.x and 31113fd6d0 to 9.5.x. Thanks!
Comment #19
alexpottComment #22
alexpottComment #23
wim leersWhat an excellent find! 😵