|
security: critical batch 1 — RCE/XSS/CORS/webhook hardening
Backend: - auth/deps: fix refresh-lock clock race (cleanup now monotonic like the cache) - core/registry: add missing structlog logger (NameError on fallback path) - config: GNAUTH_WEBHOOK_SECRET, NAVI_ALLOWED_ORIGINS (+list property) - webhooks: HMAC-SHA256 signature verification (503 unconfigured in auth mode, unsigned+warning in no-auth mode, 403 bad/stale signature, 400 bad JSON) - main: CORS from NAVI_ALLOWED_ORIGINS in auth mode (fail-fast on empty), eval router behind require_admin, /debug only registered in no-auth mode - auth routes: mobile-done sid validation (32 hex) + CSP header + safe JS escaping (reflected XSS); Secure cookie flag via helper (https base URL) - websocket: anonymous WS rejected in auth mode (closes legacy-session RCE); socket registered only after access checks; stop_session auth gate - messages: REST agent start now takes session lock + busy flag (409 on active run), contextvars reset in finally Webclient: - useMarkdown: DOMPurify.sanitize on all rendered markdown (stored XSS), image-URL scheme whitelist, delegated error listener (no inline onerror) - html.html artifact viewer: sandbox without allow-same-origin (opaque origin) - tests: DOMPurify runs under jsdom (happy-dom Node.prototype.nodeName getter breaks DOMPurify); useWebSocket tests get localStorage stub + ui-kit alias Tests: pytest 1049 passed, 1 skipped; vitest 61 passed |
|---|
|
|
| .env.example |
|---|
| docs/auth.md |
|---|
| navi/api/routes/auth.py |
|---|
| navi/api/routes/messages.py |
|---|
| navi/api/routes/webhooks.py |
|---|
| navi/api/websocket.py |
|---|
| navi/auth/deps.py |
|---|
| navi/config.py |
|---|
| navi/core/registry.py |
|---|
| navi/main.py |
|---|
| tests/integration/conftest.py |
|---|
| tests/integration/test_api_routes.py |
|---|
| tests/integration/test_websocket.py |
|---|
| tests/unit/api/test_auth_mobile_done.py 0 → 100644 |
|---|
| tests/unit/api/test_webhooks.py 0 → 100644 |
|---|
| tests/unit/api/test_websocket.py |
|---|
| tests/unit/auth/test_deps.py |
|---|
| webclient/package-lock.json |
|---|
| webclient/package.json |
|---|
| webclient/public/content-viewers/html.html |
|---|
| webclient/src/composables/useMarkdown.js |
|---|
| webclient/tests/unit/composables/useMarkdown.test.js 0 → 100644 |
|---|
| webclient/tests/unit/composables/useWebSocket.test.js |
|---|
| webclient/vitest.config.js |
|---|