Skip to content

fix(security): require authentication to place orders and enforce tok…#2363

Open
Prateek2007-cmd wants to merge 2 commits into
janavipandole:mainfrom
Prateek2007-cmd:fix/issue-2356-auth-orders
Open

fix(security): require authentication to place orders and enforce tok…#2363
Prateek2007-cmd wants to merge 2 commits into
janavipandole:mainfrom
Prateek2007-cmd:fix/issue-2356-auth-orders

Conversation

@Prateek2007-cmd

Copy link
Copy Markdown
Contributor

Description

Resolves Issue #2356 (Unauthenticated Order Placement).

The /api/orders endpoint previously lacked authorization controls, allowing anonymous unauthenticated users to create arbitrary database records. Furthermore, the endpoint trusted the email provided in the JSON payload, exposing the system to identity spoofing.

This PR implements strict access control and enforces zero-trust identity mapping.

Changes Made

  • Access Control Layer: Injected the get_current_user JWT authorization dependency into the create_order route, immediately blocking anonymous requests with a 401 Unauthorized.
  • Identity Enforcement: The Order model instantiation now ignores order_data.email and directly maps current_user.email to the order, preventing malicious users from spoofing orders under other accounts.

Type of Change

  • Security Fix
  • Data Integrity

@vercel

vercel Bot commented Jun 20, 2026

Copy link
Copy Markdown

@Prateek2007-cmd is attempting to deploy a commit to the janavipandole's projects Team on Vercel.

A member of the Team first needs to authorize it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant