[HtmlSanitizer] Add fuzzing and mutation testing workflows #1
infection.yml
on: pull_request
HtmlSanitizer
55s
Oh hello! Nice to see you.
Made with ❤️ by humans.txt
Annotations
11 warnings
|
HtmlSanitizer
Node.js 20 actions are deprecated. The following actions are running on Node.js 20 and may not work as expected: actions/checkout@v4. Actions will be forced to run with Node.js 24 by default starting June 2nd, 2026. Node.js 20 will be removed from the runner on September 16th, 2026. Please check if updated versions of these actions are available that support Node.js 24. To opt into Node.js 24 now, set the FORCE_JAVASCRIPT_ACTIONS_TO_NODE24=true environment variable on the runner or in your workflow file. Once Node.js 24 becomes the default, you can temporarily opt out by setting ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION=true. For more information see: https://github.blog/changelog/2025-09-19-deprecation-of-node-20-on-github-actions-runners/
|
|
HtmlSanitizer:
src/Symfony/Component/HtmlSanitizer/HtmlSanitizer.php#L78
Escaped Mutant for Mutator "NullSafeMethodCall":
@@ @@
}
// Visit the DOM tree and render the sanitized nodes
- return $this->domVisitors[$context]->visit($parsed)?->render() ?? '';
+ return $this->domVisitors[$context]->visit($parsed)->render() ?? '';
}
private function isValidUtf8(string $html): bool
|
|
HtmlSanitizer:
src/Symfony/Component/HtmlSanitizer/HtmlSanitizer.php#L73
Escaped Mutant for Mutator "UnwrapTrim":
@@ @@
$input = str_replace(\chr(0), '�', $input);
// Parse as HTML
- if ('' === trim($input) || !$parsed = $this->parser->parse($input, $element)) {
+ if ('' === $input || !$parsed = $this->parser->parse($input, $element)) {
return '';
}
|
|
HtmlSanitizer:
src/Symfony/Component/HtmlSanitizer/HtmlSanitizer.php#L60
Escaped Mutant for Mutator "UnwrapSubstr":
@@ @@
// Prevent DOS attack induced by extremely long HTML strings
if (-1 !== $this->config->getMaxInputLength() && \strlen($input) > $this->config->getMaxInputLength()) {
- $input = substr($input, 0, $this->config->getMaxInputLength());
+ $input = $input;
}
// Only operate on valid UTF-8 strings. This is necessary to prevent cross
|
|
HtmlSanitizer:
src/Symfony/Component/HtmlSanitizer/HtmlSanitizer.php#L60
Escaped Mutant for Mutator "IncrementInteger":
@@ @@
// Prevent DOS attack induced by extremely long HTML strings
if (-1 !== $this->config->getMaxInputLength() && \strlen($input) > $this->config->getMaxInputLength()) {
- $input = substr($input, 0, $this->config->getMaxInputLength());
+ $input = substr($input, 1, $this->config->getMaxInputLength());
}
// Only operate on valid UTF-8 strings. This is necessary to prevent cross
|
|
HtmlSanitizer:
src/Symfony/Component/HtmlSanitizer/HtmlSanitizer.php#L60
Escaped Mutant for Mutator "DecrementInteger":
@@ @@
// Prevent DOS attack induced by extremely long HTML strings
if (-1 !== $this->config->getMaxInputLength() && \strlen($input) > $this->config->getMaxInputLength()) {
- $input = substr($input, 0, $this->config->getMaxInputLength());
+ $input = substr($input, -1, $this->config->getMaxInputLength());
}
// Only operate on valid UTF-8 strings. This is necessary to prevent cross
|
|
HtmlSanitizer:
src/Symfony/Component/HtmlSanitizer/HtmlSanitizer.php#L59
Escaped Mutant for Mutator "LogicalAndAllSubExprNegation":
@@ @@
$this->domVisitors[$context] ??= $this->createDomVisitorForContext($context);
// Prevent DOS attack induced by extremely long HTML strings
- if (-1 !== $this->config->getMaxInputLength() && \strlen($input) > $this->config->getMaxInputLength()) {
+ if (!(-1 !== $this->config->getMaxInputLength()) && !(\strlen($input) > $this->config->getMaxInputLength())) {
$input = substr($input, 0, $this->config->getMaxInputLength());
}
|
|
HtmlSanitizer:
src/Symfony/Component/HtmlSanitizer/HtmlSanitizer.php#L59
Escaped Mutant for Mutator "GreaterThanNegotiation":
@@ @@
$this->domVisitors[$context] ??= $this->createDomVisitorForContext($context);
// Prevent DOS attack induced by extremely long HTML strings
- if (-1 !== $this->config->getMaxInputLength() && \strlen($input) > $this->config->getMaxInputLength()) {
+ if (-1 !== $this->config->getMaxInputLength() && \strlen($input) <= $this->config->getMaxInputLength()) {
$input = substr($input, 0, $this->config->getMaxInputLength());
}
|
|
HtmlSanitizer:
src/Symfony/Component/HtmlSanitizer/HtmlSanitizer.php#L59
Escaped Mutant for Mutator "GreaterThan":
@@ @@
$this->domVisitors[$context] ??= $this->createDomVisitorForContext($context);
// Prevent DOS attack induced by extremely long HTML strings
- if (-1 !== $this->config->getMaxInputLength() && \strlen($input) > $this->config->getMaxInputLength()) {
+ if (-1 !== $this->config->getMaxInputLength() && \strlen($input) >= $this->config->getMaxInputLength()) {
$input = substr($input, 0, $this->config->getMaxInputLength());
}
|
|
HtmlSanitizer:
src/Symfony/Component/HtmlSanitizer/HtmlSanitizer.php#L56
Escaped Mutant for Mutator "AssignCoalesce":
@@ @@
}
// Other context: build a DOM visitor
- $this->domVisitors[$context] ??= $this->createDomVisitorForContext($context);
+ $this->domVisitors[$context] = $this->createDomVisitorForContext($context);
// Prevent DOS attack induced by extremely long HTML strings
if (-1 !== $this->config->getMaxInputLength() && \strlen($input) > $this->config->getMaxInputLength()) {
|
|
HtmlSanitizer:
src/Symfony/Component/HtmlSanitizer/HtmlSanitizer.php#L36
Escaped Mutant for Mutator "Coalesce":
@@ @@
private HtmlSanitizerConfig $config,
?ParserInterface $parser = null,
) {
- $this->parser = $parser ?? new NativeParser();
+ $this->parser = new NativeParser() ?? $parser;
}
public function sanitize(string $input): string
|