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

BUG Make sure the cache shortcode value is used in FileShortcodeProvider #598

Conversation

maxime-rainville
Copy link
Contributor

@maxime-rainville maxime-rainville marked this pull request as ready for review April 29, 2024 11:13
Copy link
Contributor Author

@maxime-rainville maxime-rainville left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FileShortcodeProvider and ImageShortcodeProvider are using the same caching logic.

I only wrote test for FileShortcodeProvider because that's the class that contains the caching logic.

There's no security concern here about returning the cache markup for protected file:

  • the previous behaviour for protected file was to query on generating the markup after a cache miss
  • even if the markup reference a file you don't have access to, you'll be block once you actually try to view/download that file.

src/Shortcodes/FileShortcodeProvider.php Outdated Show resolved Hide resolved
src/Shortcodes/FileShortcodeProvider.php Outdated Show resolved Hide resolved
src/Shortcodes/FileShortcodeProvider.php Outdated Show resolved Hide resolved
src/Shortcodes/FileShortcodeProvider.php Outdated Show resolved Hide resolved
tests/php/Shortcodes/FileShortcodeProviderTest.php Outdated Show resolved Hide resolved
Copy link
Member

@GuySartorelli GuySartorelli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@GuySartorelli GuySartorelli merged commit 41378dc into silverstripe:2.2 Apr 30, 2024
9 checks passed
@GuySartorelli GuySartorelli deleted the pulls/2.2/fix-shortcode-caching branch April 30, 2024 01:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants