Skip to content

Commit d7540c9

Browse files
snebesjschroed91
authored andcommitted
HTMLPurifier Permission Fix (#63)
* Create AbstractDiff.php * updated mock test
1 parent 9b115a8 commit d7540c9

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

lib/Caxy/HtmlDiff/AbstractDiff.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,11 @@ public function initPurifier($defaultPurifierSerializerCache = null)
132132
$HTMLPurifierConfig->set('Cache.SerializerPath', $defaultPurifierSerializerCache);
133133
}
134134

135+
// Cache.SerializerPermissions defaults to 0744.
136+
// This setting allows the cache files to be deleted by any user, as they are typically
137+
// created by the web/php user (www-user, php-fpm, etc.)
138+
$HTMLPurifierConfig->set('Cache.SerializerPermissions', 0777);
139+
135140
$this->purifier = new \HTMLPurifier($HTMLPurifierConfig);
136141
}
137142

tests/Caxy/Tests/HtmlDiff/Functional/HTMLPurifierConfigTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ public function setUp()
2424

2525
$this->config->expects($this->atLeastOnce())
2626
->method('set')
27-
->with('Cache.SerializerPath', '/tmp');
27+
->with($this->anything(), $this->anything())
28+
;
2829

2930
$this->config->expects($this->any())
3031
->method('getHTMLDefinition')

0 commit comments

Comments
 (0)