improve security
This commit is contained in:
parent
e883913d3a
commit
137e4bc0c1
3 changed files with 8 additions and 0 deletions
|
@ -6,7 +6,12 @@ RUN composer install --no-dev --optimize-autoloader
|
||||||
FROM dunglas/frankenphp
|
FROM dunglas/frankenphp
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY public/ ./public
|
COPY public/ ./public
|
||||||
|
COPY src/ ./src
|
||||||
COPY --from=composer_builder /app/vendor ./vendor
|
COPY --from=composer_builder /app/vendor ./vendor
|
||||||
|
|
||||||
|
RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"
|
||||||
|
RUN sed -i 's/^\s*expose_php\s*=.*/expose_php = Off/' "$PHP_INI_DIR/php.ini"
|
||||||
|
|
||||||
ARG USER=appuser
|
ARG USER=appuser
|
||||||
RUN \
|
RUN \
|
||||||
# Use "adduser -D ${USER}" for alpine based distros
|
# Use "adduser -D ${USER}" for alpine based distros
|
||||||
|
@ -17,6 +22,7 @@ RUN \
|
||||||
chown -R ${USER}:${USER} /data/caddy && chown -R ${USER}:${USER} /config/caddy
|
chown -R ${USER}:${USER} /data/caddy && chown -R ${USER}:${USER} /config/caddy
|
||||||
USER ${USER}
|
USER ${USER}
|
||||||
|
|
||||||
|
|
||||||
LABEL "org.opencontainers.image.description"="Cool und Lässig uuid"
|
LABEL "org.opencontainers.image.description"="Cool und Lässig uuid"
|
||||||
LABEL "org.opencontainers.image.source"="https://git.hannover.ccc.de/lubiana/uuid"
|
LABEL "org.opencontainers.image.source"="https://git.hannover.ccc.de/lubiana/uuid"
|
||||||
LABEL "org.opencontainers.image.title"="UUID Service"
|
LABEL "org.opencontainers.image.title"="UUID Service"
|
||||||
|
|
|
@ -12,6 +12,7 @@ final class PlaintextResponse extends Response
|
||||||
public function __construct(?string $content, int $status = 200, array $headers = [])
|
public function __construct(?string $content, int $status = 200, array $headers = [])
|
||||||
{
|
{
|
||||||
$headers['Content-Type'] ??= 'text/plain';
|
$headers['Content-Type'] ??= 'text/plain';
|
||||||
|
$headers['X-Powered-By'] = 'PHP/9.9.9';
|
||||||
parent::__construct(
|
parent::__construct(
|
||||||
content: $content,
|
content: $content,
|
||||||
status: $status,
|
status: $status,
|
||||||
|
|
|
@ -54,4 +54,5 @@ test('it handles null content', function (): void {
|
||||||
test('it has correct defaultstatuscode', function (): void {
|
test('it has correct defaultstatuscode', function (): void {
|
||||||
$response = new PlaintextResponse('Hello, World!');
|
$response = new PlaintextResponse('Hello, World!');
|
||||||
expect($response->getStatusCode())->toBe(200);
|
expect($response->getStatusCode())->toBe(200);
|
||||||
|
expect($response->headers->get('X-Powered-By'))->toContain('PHP/9.9.9');
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue