Spaces:
Build error
Build error
Commit History
-
Migrate admin-secret generation to try the OS keychain first (D6)β
What: _generate_and_persist_admin_secret() in api/routes/admin.py now calls config.credentials.set_credential("ADMIN_SECRET", ...) first, falling back to config.settings.set_local_setting() (config.json) only if the keychain write fails or isn't available. _require_admin() needed zero changes -- it already reads via os.getenv("ADMIN_SECRET", ""), which transparently picks up whatever config.settings injected regardless of source. Subtlety specifically verified rather than assumed: set_local_setting() already injects its value into os.environ itself, but set_credential() (the keychain path) does not -- that's load_credentials_into_environ()'s job, which only runs once at process startup. Without an explicit os.environ["ADMIN_SECRET"] = new_secret on the keychain-success branch, a secret generated via the keychain would be correct on disk/in-keychain but invisible to the rest of that same running process until next restart. Added explicitly; confirmed by test. An existing install with β¦188acc4
-
feat(D1): local config-file loading + desktop-mode admin-auth hardeningβ
Phase D1 scope (PHASE_ROADMAP.md): local-config-file loading added alongside .env, and the DEBUG_MODE admin-auth bypass replaced with a desktop-appropriate default per SECURITY.md's Desktop Application Threat Model. config/settings.py: added get_app_data_dir() (OS-appropriate config dir), _load_local_config()/set_local_setting() (JSON file at <app-data>/config.json). Mirrors exactly how load_dotenv() already works -- injects values into os.environ so every existing os.getenv(...) call site in the codebase picks them up transparently, without needing to touch api/dependencies.py or any scraper. Precedence: real env var (including .env) always wins; local config only fills gaps. A missing/malformed local config file degrades to a warning, never a crash. api/routes/admin.py: _require_admin() now branches on BHARATGRAPH_DESKTOP_MODE. When unset (every current deployment), web behavior is byte-for-byte unchanged. When set, the DEBUG_MODE bypass path is skipped entirely -- a missing ADMIN_β¦e26a730
-
fix(SEC-6): reject empty-string ADMIN_SECRET -- empty string was falsy and bypassed authentication check
4040e0f
-
fix(H-04): enforce ADMIN_SECRET even when DEBUG_MODE=true -- prevents production DB wipe via accidental debug flag
d39cad8
-
fix(BUG-6,NEW-A6): add X-Admin-Secret auth on /admin/seed and /admin/pipeline; add threading.Lock for pipeline race condition
e97313c
-
fix(admin): BUG-21/22/30 β driver reuse, bond key, 7 missing scrapersβ
BUG-21: /admin/seed was calling GraphLoader() with no driver, opening a second Neo4j connection. Now passes the existing driver via GraphLoader(driver=driver). BUG-22: SCRAPER_TO_LOADER key was 'electoral_bonds' (wrong) β the scraper outputs key 'electoral_bond'. Corrected. BUG-30: 7 scrapers were running but their loader methods were never registered in SCRAPER_TO_LOADER so all records were silently discarded after the pipeline ran. Added: icij->load_icij_entities, opensanctions->load_sanctioned_entities, njdg->load_court_cases, lgd->load_local_bodies, ncrb->load_crime_reports, wikidata->load_wikidata_enrichments, datagov->load_datagov_documents.d8672be
-
fix(BUG-02/15/16): pipeline loads all 13 scrapers; reuses driver; auto-detects loaders
66a6483
-
fix(admin): seed now creates relationships, bump version to 0.29.0β
- POST /admin/seed now loads SAMPLE_DIRECTOR_LINKS (DIRECTOR_OF edges) - Returns director_links count in response - Updated try_searching list with names that have graph connections - api/main.py + admin.py: version 0.28.0 β 0.29.006efe08
-
fix(config+admin+main): 4 bugs resolvedβ
- config/settings.py: NEO4J_URI default was bolt://localhost:7687 causing HF Space to always try connecting to localhost (fails) Changed to empty string β env var must be set explicitly - graph/queries.py: same bolt://localhost default β same fix - api/routes/admin.py: load_companies() was called with SAMPLE_CONTRACTS instead of SAMPLE_COMPANIES β seed was loading wrong data as companies - api/main.py: load_dotenv() was never called β environment variables from .env and HF Space secrets were not loaded at API startupb70b0c6
-
feat: Procurement DNA + Cartel Detection + full pipeline fixβ
pipeline.py: expanded from 5 to all 20 scrapers, parallel ThreadPoolExecutor - loksabha, sebi, ed, cvc, njdg, electoral_bond, icij, opensanctions, wikidata, ibbi, ngo_darpan, cppp, ncrb, lgd β all now included - parallel=True by default (6 workers), fallback-safe per scraper - per_source count in summary output admin.py: POST /admin/pipeline triggers full pipeline in background - GET /admin/pipeline/status shows progress and last result - auto-loads into Neo4j after pipeline completes - works on HF Space with no local DB connection needed ai/forensics/bid_dna.py: TF-IDF cosine similarity on bid documents - SIMILARITY_THRESHOLD=0.72 flags near-identical bids from different vendors - cover-bid detection via price clustering (std dev analysis) ai/forensics/cartel_detector.py: 3-method cartel detection - award rotation: equal share pattern across vendors - co-bidding network: same vendors appearing together repeatedly api/routes/procurement.py: GET /procurement/bid-β¦eece913
-
fix(data): add sample data seed β politicians, companies, contracts, audit reportsβ
Root cause: Neo4j database is empty. Pipeline has not been run yet. Fix: seed.py loads 10 politicians, 5 companies, 3 contracts, 3 audit reports. admin router exposes POST /admin/seed to trigger from HF Space. Search for Modi, Gandhi, Adani, Tata, Infosys will now return results.b1d8714