Fix the security audit's findings

ShareDownload::$authenticated was a public property without #[Locked],
so a visitor with a share's link but not its password could set it from
the browser and see the file list: names, folder paths, sizes and
whether the share holds a text. The contents stayed protected; the flag
is now locked, and a test tries to set it.

Sessions hold the keys of the password shares a recipient unlocked, and
were stored unencrypted in the sessions table wherever SESSION_ENCRYPT
was not set, which includes every Docker install. They are now
encrypted unless SESSION_ENCRYPT=false. Share keys never live in the
session, so every share stays readable; people sign in again once.

The container generated an APP_KEY when none was set, printed it to the
logs and generated another on the next start, which left the shares
without a password unreadable. It now refuses to start without one and
says how to create it; docker-compose.example.yml requires it for both
services. The command it names, and the README's, now pass
--entrypoint php: the image's entrypoint ignores its arguments, so
"docker run <image> php artisan key:generate --show" never ran it.

Every proxy is trusted, so the password-reset mail built its link from
a host a forged X-Forwarded-Host could choose. It is now built from
APP_URL.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Andreas Reinhold / reini
2026-10-08 23:23:00 +02:00
co-authored by Claude Opus 5.5
parent 6c3202a0cf
commit 6578335568
8 changed files with 64 additions and 14 deletions
+6 -5
View File
@@ -4,12 +4,13 @@
#
# Quick start:
# 1. Copy this file: cp docker-compose.example.yml docker-compose.yml
# 2. Edit the settings below (APP_URL is required; uploads need HTTPS, see below)
# 2. Edit the settings below (APP_URL and APP_KEY are required; uploads need HTTPS, see below)
# 3. Start: docker compose up -d
# 4. Open your browser to your configured domain
#
# Note: APP_KEY is auto-generated on first start if not set.
# Copy it from the logs into your docker-compose.yml to persist across restarts.
# APP_KEY is required: the container does not start without it. Create one with
# docker run --rm --entrypoint php gitea.nonameweb.ch/nonameweb/sealshare:latest artisan key:generate --show
# and keep it: it decrypts the shares, so a new key makes the existing ones unreadable.
#
# ============================================
@@ -32,7 +33,7 @@ services:
environment:
# --- REQUIRED ---
APP_URL: # Your full URL, e.g. https://share.example.com
# APP_KEY: # Auto-generated if not set. Copy from logs to persist across restarts.
APP_KEY: # Required. Create one with php artisan key:generate --show (see above)
DB_DATABASE: /app/database/sqlite/database.sqlite # The SQLite file in sealshare_database
# --- HTTPS ---
@@ -90,7 +91,7 @@ services:
- sealshare_storage:/app/storage/app
- sealshare_database:/app/database/sqlite
environment:
# APP_KEY: # Same key as the app service above (auto-generated if not set)
APP_KEY: # Same key as the app service above
APP_URL: # Same URL as the app service above
DB_DATABASE: /app/database/sqlite/database.sqlite # Same as the app service above
depends_on: