PolicyEngine / PolicyEngine/policyengine-api

Security: enforce ownership and auth on user profile and saved policy routes

Open
#3,395 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 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-135
  • policyengine_api/endpoints/policy.py:81-359
  • policyengine_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_id combinations
  • Add authorization tests for cross-user access attempts

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

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.