feat: self-hosted frontend JS (offline) + docker hardening
- Vendored epub.js/pdf.js+worker/JSZip/DOMPurify in static/vendor/ - reader.html/reader.js servono i JS da /static (niente CDN, offline-ready) - CSP: rimosse allowlist CDN, aggiunto worker-src 'self' blob: - Test CSP aggiornati; tutti 16 verdi; verificato smoke test offline in container
This commit is contained in:
1 parent
e62c50c616
commit
0f15b7958f
31 files changed
+1363
-215
No files matched your search
@@ -0,0 +1,31 @@
|
||||
"""Configurazione pytest comune: env PRIMA dell'import di config.py.
|
||||
|
||||
config.py alza RuntimeError se BOOKISH_DEBUG=false senza BOOKISH_SECRET:
|
||||
per i test usiamo sempre DEBUG + secret di test.
|
||||
Per isolare i test dal volume reale, BOOKISH_DATA_DIR punta a una tmp
|
||||
dedicata, impostata qui così config.py la legge all'import.
|
||||
"""
|
||||
|
||||
import os
|
||||
import tempfile
|
||||
|
||||
import pytest
|
||||
|
||||
_DATA_TMP = tempfile.mkdtemp(prefix="bookish-test-")
|
||||
|
||||
os.environ["BOOKISH_DEBUG"] = "true"
|
||||
os.environ["BOOKISH_SECRET"] = "test-secret-dummy"
|
||||
os.environ["BOOKISH_CLEANUP_HOURS"] = "0"
|
||||
os.environ["BOOKISH_DATA_DIR"] = _DATA_TMP
|
||||
# Rate limit disattivato di default nei test: i test lo abilitano
|
||||
# esplicitamente quando vogliono verificarlo (evita budget esauriti).
|
||||
os.environ["BOOKISH_RATE_LIMIT_UPLOAD"] = "0"
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def _reset_rate_state():
|
||||
"""Pulisce lo stato globale del rate-limit tra i test."""
|
||||
import bookish.services.security as sec
|
||||
with sec._rate_lock:
|
||||
sec._rate.clear()
|
||||
yield
|
||||
Reference in new issue
Block a user