Skip to content

Conversation

@SAK001-WB
Copy link
Collaborator

Description:
This PR updates the POST /api/save route to use authentication middleware (protect) instead of accepting userId in the request body. The authenticated user's ID is now securely extracted from the JWT token.

Changes:

Applied protect middleware to /api/save route

Removed userId from client request body

Extracted userId from req.user (populated via verified token)

Preserved existing error handling and Prisma logic

Why:
To prevent unauthorized users from saving pins on behalf of other users and to follow security best practices by trusting only verified user identities.

@SAK001-WB SAK001-WB added this to the sprint 3 milestone Jun 12, 2025
@SAK001-WB SAK001-WB requested a review from DevOppss7 June 12, 2025 18:29
@SAK001-WB SAK001-WB self-assigned this Jun 12, 2025
@SAK001-WB SAK001-WB added the enhancement New feature or request label Jun 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants