diff --git a/app/Config/app.php b/app/Config/app.php
index acd27e98c..7aa94b4f2 100644
--- a/app/Config/app.php
+++ b/app/Config/app.php
@@ -42,17 +42,17 @@ return [
// Even when overridden the WYSIWYG editor may still escape script content.
'allow_content_scripts' => env('ALLOW_CONTENT_SCRIPTS', false),
- // Control the behaviour of page content filtering.
+ // Control the behaviour of content filtering, primarily used for page content.
// This setting is a collection of characters which represent different available filters:
- // - j - Filter out JavaScript based content
- // - h - Filter out unexpected, potentially dangerous, HTML elements
+ // - j - Filter out JavaScript and unknown binary data based content
+ // - h - Filter out unexpected, and potentially dangerous, HTML elements
// - f - Filter out unexpected form elements
// - a - Run content through a more complex allow-list filter
// This defaults to using all filters, unless ALLOW_CONTENT_SCRIPTS is set to true in which case no filters are used.
// Note: These filters are a best attempt, and may not be 100% effective. They are typically a layer used in addition to other security measures.
// TODO - Add to example env
// TODO - Remove allow_content_scripts option above
- 'content_filtering' => env('CONTENT_FILTERING', env('ALLOW_CONTENT_SCRIPTS', false) === true ? '' : 'jfha'),
+ 'content_filtering' => env('APP_CONTENT_FILTERING', env('ALLOW_CONTENT_SCRIPTS', false) === true ? '' : 'jhfa'),
// Allow server-side fetches to be performed to potentially unknown
// and user-provided locations. Primarily used in exports when loading
diff --git a/app/Entities/Tools/PageContent.php b/app/Entities/Tools/PageContent.php
index f8a061739..4f72e7c49 100644
--- a/app/Entities/Tools/PageContent.php
+++ b/app/Entities/Tools/PageContent.php
@@ -341,7 +341,8 @@ class PageContent
$contentId = $this->page->id;
$contentTime = $this->page->updated_at?->timestamp ?? time();
$appVersion = AppVersion::get();
- return "page-content-cache::{$appVersion}::{$contentId}::{$contentTime}::{$contentHash}";
+ $filterConfig = config('app.content_filtering') ?? '';
+ return "page-content-cache::{$filterConfig}::{$appVersion}::{$contentId}::{$contentTime}::{$contentHash}";
}
/**
diff --git a/phpunit.xml b/phpunit.xml
index 8a7ab9cb7..94fc002b7 100644
--- a/phpunit.xml
+++ b/phpunit.xml
@@ -34,6 +34,7 @@
+
diff --git a/tests/Entity/PageContentFilteringTest.php b/tests/Entity/PageContentFilteringTest.php
index e1295034d..8103fae1d 100644
--- a/tests/Entity/PageContentFilteringTest.php
+++ b/tests/Entity/PageContentFilteringTest.php
@@ -22,6 +22,8 @@ class PageContentFilteringTest extends TestCase
public function test_more_complex_content_script_escaping_scenarios()
{
+ config()->set('app.content_filtering', 'j');
+
$checks = [
"