This bundle includes three libraries for the security of files.
add on your composer.json the repository:
"repositories": [
{
"type": "vcs",
"url": "github:ipedis/security-file-bundle.git"
},
{
"type": "vcs",
"url": "github:ipedis/file-sanitizer.git"
},
{
"type": "vcs",
"url": "github:ipedis/validation-handler.git"
}
...
then
composer require "ipedis/security-file-bundle"
Configuration of file sanitizer is on the security_file.yaml :
# config/packages/security_file.yaml
security_file:
sanitizers:
html_sanitizer:
type: html
config:
ignored_step:
custom_step:
xml_sanitizer:
type: xml
config:
ignored_step:
custom_step:
......We can add many configuration . We use the camelCase of the name of the configuration to use it on service
ex: to use html_sanitizer on this configuration above :
class DummyHtml
{
public function __construct(SanitizerInterface $htmlSanitizer)
{}
.....To use Bomb scanner we can use BombScannerDecorator service.
By default, engine used on this service is zip.
But we can modify it or add more engine with configuration in security_file:
# config/packages/security_file.yaml
security_file:
......
scanner:
engines:
- zip
- rarUse service FileValidator