Spaces:
Running
Running
Commit History
-
Run the container as a non-root user (item from review: Dockerfile hardening)
ClaudeUnverified signatureThe image ran as root with no USER directive - if a scraping dependency or a malicious response ever led to arbitrary code execution, that code ran as root inside the container. Also dropped a redundant `pip install playwright` (already pulled in by requirements.txt). - Dockerfile: added `useradd -m -u 1000 user` + `USER user`, following Hugging Face Spaces' own documented convention for custom Docker Spaces (this app deploys to a HF Space). - app.py: api_lifespan now launches Chromium with `args=["--no-sandbox"]`. Chromium's own internal sandbox needs privileges a non-root container user doesn't have and fails to launch at all without this - the container itself remains the isolation boundary. Added a test (written first, confirmed failing, then made to pass) asserting the launch call carries this flag. Validated end-to-end rather than by inspection alone, since this is the one change here with real risk of breaking the live deployment: started dockerd in this sandbox,…285bc99
-
Mirror SERPent from Hugging Face Space with bug fixes
ClaudeUnverified signatureMirrors OrganizedProgrammers/SERPent (https://huggingface.co/spaces/OrganizedProgrammers/SERPent) with the following fixes applied on top: - app.py: make /serp/search try all queries concurrently instead of sequentially, and surface per-query backend failures in the response's error field instead of silently dropping them when at least one other query in the batch succeeded. - app.py: add opt-in SERPENT_API_KEY protection (X-API-Key or Authorization: Bearer) gating REST and MCP alike via HTTP middleware, closing the unauthenticated open-scraping-proxy surface. Unset by default, so behavior is unchanged until explicitly enabled. - app.py: load docs/docs.md safely (context-managed read, fallback description) instead of an unguarded open().read() at import time. - serp.py: raise a clear BrowserUnavailableError instead of an AttributeError when Playwright failed to start and pw_browser is None. - serp.py: clamp n_results to [1, 100] in SerpQuery so a negative or huge val…cb1e234