Release 2.58 (#5952)

* bump version
* fix formatting locale reset after embedded controller sub-requests (#5944)
* fix GHSA-c6w6-57jj-62vh
* fix GHSA-m492-gv72-xvxj
* fix GHSA-jr9p-4h4j-6c58
* make sure to only use JS logic to call API endpoints
* fixes GHSA-r8vr-m544-qh4h
* make sure to only use JS logic to call API endpoints
* fix GHSA-rw46-qg69-vg6h
* fix GHSA-pj8j-p4g4-4vw8 - prevent kimai from rendering images via markdown
* fix GHSA-pj8j-p4g4-4vw8 - use a safe network client to prevent SSRF via images
* fix GHSA-xv4r-4885-gwpg
* fix GHSA-pgcc-vfmc-7cw5 - move GET routes to API with POST method to prevent CSRF
* fix tooltip survives page reload
* updated wizard images
* split wizard and password reset subscriber into two classes
* relax upper php limit
* added zizmor workflow scans and apply findings
* user permissions <name>_other_profile  now respect teams
* move all linting steps to new job
* updated docker image version names
* use .env.local for storing APP_SECRET
* improve build order and use given tag as ref for checkout, not default main branch
* improved APP_SECRET handling, see entrypoint.sh
* use local code for building the image for more flexibility, added dockerignore
This commit is contained in:
Kevin Papst
2026-05-25 15:39:47 +02:00
committed by GitHub
parent 8d245ae223
commit 31a8f887a5
85 changed files with 2737 additions and 472 deletions

View File

@@ -13,6 +13,8 @@ use App\Constants;
use App\Utils\FileHelper;
use Mpdf\Config\ConfigVariables;
use Mpdf\Config\FontVariables;
use Mpdf\Container\SimpleContainer;
use Mpdf\Http\ClientInterface;
use Mpdf\Mpdf;
use Mpdf\Output\Destination;
@@ -20,7 +22,8 @@ final class MPdfConverter implements HtmlToPdfConverter
{
public function __construct(
private readonly FileHelper $fileHelper,
private readonly string $cacheDirectory
private readonly string $cacheDirectory,
private readonly ?ClientInterface $httpClient = null,
)
{
}
@@ -116,7 +119,17 @@ final class MPdfConverter implements HtmlToPdfConverter
unset($options['additional_xmp_rdf']);
}
$mpdf = new Mpdf($options);
// Inject a safe HTTP client into mPDF (via its service container) so
// remote resources referenced from Twig templates — typically `<img
// src="...">` for company logos — cannot be abused to probe private
// networks. The configured Symfony client is decorated with
// NoPrivateNetworkHttpClient at the service-container level.
// @see https://github.com/kimai/kimai/security/advisories/GHSA-pj8j-p4g4-4vw8
$container = $this->httpClient !== null
? new SimpleContainer(['httpClient' => $this->httpClient])
: null;
$mpdf = new Mpdf($options, $container);
$mpdf->creator = Constants::SOFTWARE;
if (\count($associatedFiles) > 0) {

View File

@@ -0,0 +1,76 @@
<?php
/*
* This file is part of the Kimai time-tracking app.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace App\Pdf;
use Mpdf\Http\ClientInterface;
use Mpdf\PsrHttpMessageShim\Response;
use Psr\Http\Message\RequestInterface;
use Symfony\Contracts\HttpClient\Exception\ExceptionInterface as HttpClientExceptionInterface;
use Symfony\Contracts\HttpClient\HttpClientInterface;
/**
* Bridges mPDF's HTTP client to Symfonys NoPrivateNetworkHttpClient.
*
* Prevents the PDF renderer from issuing outbound requests to private network targets,
* closing the SSRF vector for `<img src="...">` references in custom Twig invoice templates.
*
* Blocked requests are translated to a non-2xx response so mPDF logs the failure
* and renders a placeholder for the missing image without aborting PDF generation.
*
* @see https://github.com/kimai/kimai/security/advisories/GHSA-pj8j-p4g4-4vw8
*/
final class SafeRemoteContentClient implements ClientInterface
{
/**
* Timeout in seconds: a slow or unreachable remote target should not block PDF rendering.
*/
private const TIMEOUT = 10;
public function __construct(private readonly HttpClientInterface $client)
{
}
public function sendRequest(RequestInterface $request): Response
{
try {
$response = $this->client->request(
$request->getMethod(),
(string) $request->getUri(),
[
'headers' => $this->flattenHeaders($request),
'timeout' => self::TIMEOUT,
'max_duration' => self::TIMEOUT,
]
);
return new Response(
$response->getStatusCode(),
[],
$response->getContent(false)
);
} catch (HttpClientExceptionInterface) {
// Request blocked (private network), DNS failure, timeout, etc.
return new Response(502);
}
}
/**
* @return array<string, string>
*/
private function flattenHeaders(RequestInterface $request): array
{
$headers = [];
foreach ($request->getHeaders() as $name => $values) {
$headers[$name] = implode(', ', $values);
}
return $headers;
}
}