PolicyEngine / PolicyEngine/policyengine-api
Security: enforce ownership and auth on user profile and saved policy routes
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 unauthenticated user-profile and user-policy routes with caller-controlled identifiers.
Severity
High
Impact
Any client can create, read, or mutate another user’s profile and saved policies by supplying arbitrary auth0_id or user_id values.
Affected code
policyengine_api/routes/user_profile_routes.py:12-135policyengine_api/endpoints/policy.py:81-359policyengine_api/api.py:100-101,148-154
Details
The affected routes have no auth or ownership checks and are mounted with app-wide CORS enabled.
Expected behavior
User-scoped routes should require authenticated callers and enforce ownership based on the authenticated principal, not caller-supplied IDs.
Suggested remediation
- Add auth middleware/decorators to user-scoped routes
- Derive subject/ownership from the validated token
- Reject caller-supplied foreign
auth0_id/user_idcombinations - Add authorization tests for cross-user access attempts
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Read policyengine_api/routes/user_profile_routes.py, policyengine_api/endpoints/policy.py, and the route mounts in policyengine_api/api.py. Identify the existing authentication mechanism and how the validated principal is exposed before adding authorization tests for cross-user access. Done means user-profile and saved-policy routes require authentication and reject caller-supplied foreign auth0_id or user_id values.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api, authentication, authorization, backend, security
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100