-
Notifications
You must be signed in to change notification settings - Fork 68
Fix authorization middleware #344
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
Conversation
|
Thank you for opening this PR! Before a maintainer takes a look, it would be really helpful if you could walk through your changes using GitHub's review tools. Please take a moment to:
More information on how to conduct a self review: This helps make the review process smoother and gives us a clearer understanding of your thought process. Once you've added your self-review, we'll continue from our side. Thank you! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added session validation middleware
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added tests for middleware validation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
implemented creds validation helpers
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added tests for helper functions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
using session creds for bulk operations
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wrapped all task endpoints with auth middleware
Hell1213
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
backend/controllers/get_tasks.go - Use session credentials instead of request params
backend/controllers/add_task.go - Use session credentials instead of request params
backend/controllers/edit_task.go - Use session credentials instead of request params
backend/controllers/modify_task.go - Use session credentials instead of request params
backend/controllers/complete_task.go - Use session credentials instead of request params
backend/controllers/delete_task.go - Use session credentials instead of request params
backend/controllers/delete_tasks.go - Use session credentials for bulk operations
|
hey @its-me-abhishek PR ready for review, fixed: Session-based authorization for task endpoints. |
Fixed critical security vulnerability where task endpoints accepted user credentials directly from requests without validating authenticated sessions, allowing unauthorized access to any user's tasks.
Fixes: #338
Changes Made
Added authentication middleware to validate user sessions
Created credential validation helpers to verify request params match session
Updated all 8 task endpoints to use session-based authentication
Integrated middleware protection for all task operations
Checklist
npx prettier --write .(for formatting)gofmt -w .(for Go backend)npm test(for JS/TS testing)Additional Notes
All task endpoints now require valid session before processing. Request credentials are validated against session data. Returns 401 for missing session, 403 for credential mismatch. Backward compatible with existing frontend.