Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: secure send_notification endpoint and ensure correct user association #1190

Merged
merged 6 commits into from
Mar 1, 2025

Conversation

ObiFaith
Copy link
Contributor

@ObiFaith ObiFaith commented Mar 1, 2025

Description

This PR addresses a security issue where the /api/v1/notifications/send endpoint lacks authorization, allowing anyone to send notifications. As a result, the user_id in the notification table is set to NULL, preventing users from retrieving their notifications correctly.

Related Issue (Link to issue ticket)

Motivation and Context

🚀 Security Fix: Ensures that only authenticated users can send notifications.

🔍 Data Consistency: Prevents NULL values in the user_id field.

🛠 User Experience: Ensures that users see the correct notifications associated with their accounts.

How Has This Been Tested?

The changes have been tested using unit tests and Postman

Screenshots (if appropriate - Postman, etc):

Screenshot 2025-03-01 122050
Screenshot 2025-03-01 123305
Screenshot 2025-03-01 123653

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@joboy-dev joboy-dev merged commit 3407c89 into hngprojects:dev Mar 1, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants