Skip to content

Commit d180cc0

Browse files
committed
fixes for Laravel
1 parent e467aec commit d180cc0

File tree

5 files changed

+14
-10
lines changed

5 files changed

+14
-10
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
# Sanitize your HTML against XSS threats.
1+
# Clean your strings from XSS threats
22

33
[![Latest Version on Packagist](https://img.shields.io/packagist/v/medilies/xssless.svg?style=flat-square)](https://packagist.org/packages/medilies/xssless)
4-
[![GitHub Tests Action Status](https://img.shields.io/github/actions/workflow/status/medilies/xssless/run-tests.yml?branch=main&label=tests&style=flat-square)](https://github.com/medilies/xssless/actions?query=workflow%3Arun-tests+branch%3Amain)
5-
[![GitHub Code Style Action Status](https://img.shields.io/github/actions/workflow/status/medilies/xssless/fix-php-code-style-issues.yml?branch=main&label=code%20style&style=flat-square)](https://github.com/medilies/xssless/actions?query=workflow%3A"Fix+PHP+code+style+issues"+branch%3Amain)
4+
[![pest](https://img.shields.io/github/actions/workflow/status/medilies/xssless/run-tests.yml?branch=main&label=tests&style=flat-square)](https://github.com/medilies/xssless/actions?query=workflow%3Arun-tests+branch%3Amain)
5+
[![phpstan](https://img.shields.io/github/actions/workflow/status/medilies/xssless/fix-php-code-style-issues.yml?branch=main&label=phpstan&style=flat-square)](https://github.com/medilies/xssless/actions?query=workflow%3A"Fix+PHP+code+style+issues"+branch%3Amain)
66
[![Total Downloads](https://img.shields.io/packagist/dt/medilies/xssless.svg?style=flat-square)](https://packagist.org/packages/medilies/xssless)
77

88
Use what is recommended by [OWASP](https://cheatsheetseries.owasp.org/cheatsheets/Cross_Site_Scripting_Prevention_Cheat_Sheet.html#html-sanitization):
@@ -26,7 +26,7 @@ $config = new Medilies\Xssless\Dompurify\DompurifyCliConfig('node', 'npm');
2626

2727
(new Medilies\Xssless\Xssless)
2828
->using($config)
29-
->setup($html);
29+
->setup();
3030
```
3131

3232
### Laravel setup

src/Xssless.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public function usingLaravelConfig(): static
5151
$config = config("xssless.{$driver}");
5252

5353
if (! $config instanceof ConfigInterface) {
54-
throw new XsslessException("xssless.{$driver} must implement: ".ConfigInterface::class);
54+
throw new XsslessException("xssless.drivers.{$driver} must implement: ".ConfigInterface::class);
5555
}
5656

5757
$this->config = $config;

src/laravel/Commands/StartCommand.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public function handle(): void
1818
$service = Xssless::usingLaravelConfig()->start();
1919

2020
$terminate = function ($signal) use ($service) {
21-
$this->alert("Terminating...\n");
21+
$this->warn("Terminating...\n");
2222
$service->stop();
2323
exit;
2424
};
@@ -30,8 +30,10 @@ public function handle(): void
3030
$output = $service->getIncrementalOutput();
3131
$errorOutput = $service->getIncrementalErrorOutput();
3232

33-
$this->comment($output);
34-
if (! empty($errorOutput)) {
33+
if ($output !== '') {
34+
$this->line($output);
35+
}
36+
if ($errorOutput !== '') {
3537
$this->error($errorOutput);
3638
}
3739

src/laravel/config/xssless.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
return [
77
'default' => 'dompurify-cli',
88

9-
'cleaners' => [
9+
'drivers' => [
1010
'dompurify-cli' => new DompurifyCliConfig(
1111
env('NODE_PATH', 'node'),
1212
env('NPM_PATH', 'npm'),

tests/Dompurify/DompurifyServiceTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,5 +70,7 @@
7070
));
7171

7272
expect(fn () => $service->start())->toThrow(ProcessFailedException::class);
73-
expect($service->serviceProcess->getTermSignal() === 127); // TODO https://github.com/medilies/xssless/actions/runs/10283025153/job/28455979969
73+
expect($service->serviceProcess->getTermSignal())->toBe(127);
74+
// TODO: fix https://github.com/medilies/xssless/actions/runs/10283025153/job/28455979969
75+
// TODO: wait for signal
7476
});

0 commit comments

Comments
 (0)