PolicyEngine / PolicyEngine/policyengine-uk-chat
Frontend does not send JWTs to the backend
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1
- Forks
- 1
- Avg merge
- 16h 46m
- Merged PRs (30d)
- 2
Description
Problem
Frontend API calls do not consistently authenticate requests to the backend.
Observed behavior:
- Generic API calls send only
Content-Type. - Chat sends
X-User-Idand bodyuser_id, but does not sendAuthorization: Bearer <token>. - The Next.js proxy drops auth headers instead of forwarding them to the backend.
Risk
The backend cannot distinguish an authenticated caller from a spoofed caller-supplied user identifier. Any endpoint that trusts X-User-Id or user_id is therefore not using a real auth boundary.
Expected behavior
Frontend requests that access user-specific data or spend should include a verified auth token, and proxy routes should preserve the Authorization header.
Acceptance criteria
- Frontend API helpers attach
Authorization: Bearer <token>where backend auth is required. - The Next.js proxy forwards auth headers to the backend.
- Backend protected endpoints reject missing or invalid tokens.
- Tests cover authenticated and unauthenticated frontend/backend request paths.
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
Start by locating the frontend API helpers, Next.js proxy routes, and backend protected endpoints described in the issue. Trace how authenticated and unauthenticated requests currently behave, then add coverage for token forwarding, rejection of missing or invalid tokens, and user-specific request paths until all acceptance criteria pass.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- next.js, python
- Domain
- api, authentication, backend, frontend, security
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100