PolicyEngine / PolicyEngine/policyengine-api

Security: gate Anthropic-backed simulation analysis with auth and quotas

Open
#3,397 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
18
Forks
33
Avg merge
23h 40m
Merged PRs (30d)
22

Description

Summary

policyengine-api exposes an unauthenticated Anthropic-backed simulation analysis endpoint.

Severity

High

Impact

Attackers can burn LLM quota and persist arbitrary analysis records by repeatedly calling the endpoint.

Affected code

  • policyengine_api/routes/simulation_analysis_routes.py:19-78
  • policyengine_api/services/ai_analysis_service.py:45-77

Details

/simulation-analysis accepts public requests, and AIAnalysisService immediately initializes an Anthropic client with ANTHROPIC_API_KEY and streams a response for new prompts.

Expected behavior

LLM-backed analysis should require auth, rate limits, and ideally per-user quotas or explicit feature gating.

Suggested remediation

  • Require authenticated callers
  • Add rate limiting / quota enforcement
  • Consider caching and internal-only generation paths for expensive prompts
  • Add tests proving unauthenticated requests are denied

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with policyengine_api/routes/simulation_analysis_routes.py:19-78 and policyengine_api/services/ai_analysis_service.py:45-77 to trace how unauthenticated requests reach Anthropic-backed analysis. Review the endpoint and service behavior, then add tests proving unauthenticated requests are denied and verify the intended rate-limit or quota enforcement. Done means public callers cannot repeatedly consume LLM quota or persist arbitrary analysis records.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api, backend, security
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.