Admin can browse NAS files under data/local including subfolders and share
them in place. Shares use file_path=local-ref, skip storage quota, and never
delete the original file on expire.
#514 began validating `background` as an http(s) URL against the *merged*
config, so a value stored by an older release (a relative path, or one
containing a space/parenthesis — all legal before) made every subsequent
settings save return 400, including saves that never touched `background`.
Existing deployments could not change any setting at all.
Validate only values that actually change: an untouched legacy value is
kept as-is (it is still html-escaped on render), while any edit must pass
validation. Regression tests cover both directions and fail without this
change.
Also treat OverflowError from hashlib.scrypt as a non-matching hash so a
hand-crafted n/r/p cannot disturb the login path on runtimes that raise it.
- ci.yml: ruff + pytest on push/PR, installing from the hashed lockfile
with --require-hashes, plus a lockfile-vs-requirements consistency
check (dependabot cannot regenerate the lockfile; drift was silent).
- test_api_contract.py: deep-scans public config, dashboard, admin file
list and share metadata responses for camelCase keys - the regression
net for the D7 public-config leak found during review.
- quota.get_storage_usage (runs on every upload) now aggregates via Sum
instead of loading every row
- dashboard simple counters (total/size/expired/active/text/chunked/used,
yesterday/today, top suffixes, recent 8) moved to SQL; the per-row health
rules engine keeps its single pass (documented)
- storage contract drops UploadFile in favor of BinaryIO (+content_type param),
completing the framework decoupling of the storage layer
- LocalFileClass.read() leaked an open fd and its handle was passed where
save_file expected UploadFile — /admin/local/share 500ed on every call;
now reads bytes via with-block and shares correctly (regression tests added)
- OneDrive save_file additionally had save_path called as a function — fixed
- opendal_scheme was read directly by the OpenDAL backend but never declared
in DEFAULT_CONFIG: selecting that backend crashed with AttributeError
- chunk_expire_hours existed only as getattr fallbacks in two modules
- refresh_settings now warns about unknown user_config keys
- meta-test scans the codebase so any future settings.X reference without a
DEFAULT_CONFIG declaration fails the suite
- apps/base/setup_wizard.py: form parsing rules, setup options, and the
two admin-facing HTML pages
- apps/base/pages.py: setup/assets/index/robots/public-config routes and
theme resolution (404 handler registered on the app in main.py)
- tests updated to import from the new modules
- new hashes use scrypt (n=2^14, r=8, p=1); sha256 and plaintext formats
keep verifying unchanged, so existing deployments are unaffected
- on successful login a legacy-stored admin password is rehashed to scrypt
in the settings KeyValue row
- add password_needs_rehash() and extend scheme detection; stdlib only, no
new dependency
- add pyproject.toml with pytest config and dev dependency group (PEP 735)
- add ruff (core correctness rules) + pre-commit hook
- fix stored XSS: html.escape site config before index template injection,
with regression tests
- log previously swallowed cleanup exceptions in upload rollback paths
- consolidate three duplicate path generators into build_file_path
(also aligns chunk/presign date dirs to get_now() instead of local time)
- drop redundant ip_limit sync in load_config (refresh_settings covers all limiters)
- remove dead code (calculate_file_hash, commented-out block), two orphan
guide docs, and stale .gitignore entries
- add dependabot for pip, docker, and github-actions
- bump starlette 1.3.1 -> 1.6.0 (no breaking API changes; verified with the
full test suite plus an ASGI smoke test incl. Range downloads)
- skip theme asset tests when themes/ is not built locally
Close the remaining security gaps: validate upload content against
file signatures, rate-limit admin login failures with configurable
thresholds, and run the container as uid 1000 instead of root.
Apply the useful security fixes from PR #494 with review corrections:
validate expire_style through a shared helper, accept previous download
token window, detect SQL dialect via Tortoise capabilities, close remote
download sessions on client abort, and disable invalid CORS credentials.
Upgrade aiohttp and related packages, harden local file and storage path checks, tighten password/JWT comparisons, and default Docker forwarded IP trust to empty.