Ares is built on the assumption that the LLM and every external page it reads are untrusted inputs. Store data changes only happen through human-approved write tools, agent loops are bounded on three axes (iterations, tool calls, wall clock), final answers must be grounded in successful tool results, roles are re-checked server-side on every request, and the crawler refuses non-public network addresses. The table below maps each threat to the code that mitigates it; nothing here claims protection the code does not have.
| Threat | Mitigation | Where |
|---|---|---|
| A model deciding to change store data on its own | Write tools never execute directly: the engine queues the call, creates an ApprovalRequest row and pauses the run in WAITING_FOR_APPROVAL until a human approves or rejects it; rejected calls are recorded and never executed. | backend/app/agent/engine.py (_request_approval, _drain_pending), backend/app/tools/registry.py (ToolAccess.WRITE) |
| Prompt injection through crawled web pages | Pages are parsed into structured fields only (JSON-LD Product first, OpenGraph fallback) and the system prompt instructs the model to treat scraped text as untrusted data, never as instructions. Extracted page fields such as product names do flow back through list_opportunities, so this is a data-shape plus prompt mitigation, not a sandbox. | backend/app/intelligence/extraction.py (extract_page), backend/app/agent/prompts.py (SYSTEM_PROMPT) |
| A runaway agent loop | The loop is bounded on three axes: max iterations, max tool calls and a wall-clock deadline; exceeding any of them fails the run instead of continuing. Defaults are 8 iterations, 20 tool calls and 240 seconds. | backend/app/agent/engine.py (_loop, AgentTimeout), backend/app/config.py (agent_max_iterations) |
| A model inventing products or numbers | With strict grounding on by default, a final answer is checked against the tool results that actually succeeded; an ungrounded answer gets one correction round and then fails the run rather than shipping. | backend/app/agent/grounding.py (classify_response), backend/app/config.py (strict_tool_grounding) |
| A user giving themselves a higher role | Roles are never self-assigned: public sign-up creates viewers only, creating any other role requires an admin Bearer token, and every request re-checks the role server-side through a FastAPI dependency. | backend/app/api/auth.py (register, require_role), backend/app/services/auth.py (role_at_least) |
| Brute-forcing logins or hammering the API | Login is rate limited (20 per minute by default) as are agent runs and research jobs; passwords use memory-hard scrypt with a per-user salt; an optional shared X-API-Key can gate the whole API. Limits are per-endpoint, not a global WAF. | backend/app/api/auth.py (login, rate_limit), backend/app/services/rate_limit.py, backend/app/config.py (api_key) |
| Secrets in the repository | All settings are environment driven; config holds only safe-to-publish defaults and .env files are git-ignored, so values like openai_api_key or api_key never land in version control. | backend/app/config.py (Settings), .gitignore (.env* rule) |
| The crawler being pointed at internal addresses | Every URL is resolved and checked before fetch: private, loopback, link-local, reserved, multicast and unspecified addresses are blocked unless crawler_allow_private_addresses is explicitly enabled for local development. | backend/app/intelligence/crawler.py (_is_public_http_url, ResponsibleCrawler.fetch) |