Switch to Symfony’s HTML Sanitizer package
This commit is contained in:
parent
e91f3e0d17
commit
e98a90fe1e
4 changed files with 212 additions and 88 deletions
|
@ -15,6 +15,8 @@ use Lcobucci\JWT\Configuration;
|
|||
use Lcobucci\JWT\Signer\Hmac\Sha256;
|
||||
use Lcobucci\JWT\Signer\Key\InMemory;
|
||||
use Lcobucci\JWT\Validation\Constraint\SignedWith;
|
||||
use Symfony\Component\HtmlSanitizer\HtmlSanitizer;
|
||||
use Symfony\Component\HtmlSanitizer\HtmlSanitizerConfig;
|
||||
|
||||
class AppServiceProvider extends ServiceProvider
|
||||
{
|
||||
|
@ -91,6 +93,15 @@ class AppServiceProvider extends ServiceProvider
|
|||
|
||||
return $config;
|
||||
});
|
||||
|
||||
// Configure HtmlSanitizer
|
||||
$this->app->bind(HtmlSanitizer::class, function () {
|
||||
return new HtmlSanitizer(
|
||||
(new HtmlSanitizerConfig())
|
||||
->allowSafeElements()
|
||||
->forceAttribute('a', 'rel', 'noopener nofollow')
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue