Spaces:
Build error
Build error
Commit History
-
fix: centralize + desktop-mode-adapt the logs directory (P-1)
New finding while implementing this: config/settings.py's LOGS_PATH constant was dead code -- grepped every consumer, zero hits anywhere outside its own definition. The 3 real log-writing call sites each independently hardcoded or recomputed their own path instead: - scrapers/base_scraper.py: a bare CWD-relative "logs" string - api/middleware/audit_logger.py: __file__-relative, 3 dirname() calls up to project root - blockchain/audit_chain.py: __file__-relative, 2 dirname() calls up to project root (different file depth, same target) All 3 resolve to the identical directory TODAY only because Docker's fixed WORKDIR makes CWD == project root -- a coincidence, not a guarantee. A desktop build has no such guarantee: a double-clicked app's CWD is unpredictable, so the CWD-relative scraper logs and the __file__-relative audit logs could silently end up in two different, unrelated directories the moment this ships as a desktop app. Fix: LOGS_PATH is now desktop-mode-aware (same…6d12c24
-
cleanup(input_validator): remove dead ALLOWED_CHARS regex
Root cause: a module-level character-allowlist regex sat directly next to the two checks that ARE live in dispatch() (MAX_QUERY_LEN, CYPHER_INJECTION), but dispatch() never references it. Confirmed via grep: zero references anywhere else in the repository either. The 'obvious' fix -- wire it into dispatch() -- was checked and rejected. The allowlist's excluded-character set rejects '&', which appears in real, well-known Indian company names this platform needs to search. Verified: 'Larsen & Toubro' and 'M&M' both fail to match. Enabling it as-is would have been a functional regression. Verified: py_compile passes.04bce6d
-
fix(SEARCH-2,SEARCH-3): add datagov/crimereport filter buttons; add Arabic script U+0600-U+06FF to ALLOWED_CHARS for Urdu/Sindhi search
297cc9e -
fix(BACKEND-1): move rate limiter eviction AFTER current key pruning -- prevents losing rate-limit tracking on burst-after-idle patterns
9d85e1e
-
fix(H-05): rate limiter eviction uses ts[0] (oldest) not ts[-1] (newest) -- prevents sliding window bypass attack
c7c0765
-
fix(NEW-A3 part1): replace em-dashes/smart-quotes in 56+ Python files -- CI requires pure ASCII source
8a0fba4
-
fix(BUG-13/14): audit_logger uses per-process file; rate_limiter evicts stale windows
93aa1a1 -
fix(BUG-09): removed IGNORECASE — 'Union Bank' and 'Call Centre' no longer blocked
dd61f29
-
feat(security):complete — security hardening and provenance
- api/middleware/rate_limiter.py: sliding window per IP per endpoint class Limits: /search 100/min, /investigate 30/min, /export 10/min, /admin 5/min Returns HTTP 429 with Retry-After header. IP stored as SHA-256 hash (privacy) - api/middleware/security_headers.py: CSP, HSTS, X-Frame-Options, nosniff, Referrer-Policy, Permissions-Policy on every response - api/middleware/input_validator.py: max 200 chars, Cypher injection detection, Indian script Unicode range allowlist for multilingual queries - api/middleware/audit_logger.py: append-only JSONL audit log with SHA-256 hash chain. Each entry includes hash of previous entry for tamper detection - blockchain/audit_chain.py: compute_daily_root() builds Merkle-style daily root hash from all entries. store_root_hash() anchors it in Neo4j AuditRoot node. verify_chain() confirms chain integrity end-to-end - api/main.py: all 4 middleware registered in correct orderb1a489c