-
Notifications
You must be signed in to change notification settings - Fork 69
security: add authentication to logs endpoint and filter by user #409
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! |
backend/controllers/get_logs.go
Outdated
| // Get user's UUID to filter logs | ||
| userUUID, _ := userInfo["uuid"].(string) | ||
|
|
||
| // Get the 'last' query parameter, default to 100 |
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.
should also add a cap to the last value. one may request for a pretty big number which can cause crashes. Also maybe just maintain the same threshold, overall as well. To prevent unnecessary overheads
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.
A hard cap of 20 should probably be enough
Add session authentication to /sync/logs endpoint and filter logs by user UUID so users can only see their own logs. - Require valid session to access logs endpoint - Add GetLogsByUser() to filter logs by user UUID - Return 401 Unauthorized for unauthenticated requests - Update SyncLogsHandler signature to accept session store Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Change default from 100 to 20 - Enforce maximum of 20 entries regardless of request - Prevents resource exhaustion from large requests Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
b3c5c38 to
ccba488
Compare
|
Addressed the feedback in commit ccba488:
The cap is enforced with a simple check after parsing the parameter. |
Summary
Security Issue Addressed
Unauthenticated Logs Endpoint (Medium) - Previously, the /sync/logs endpoint had no authentication, allowing anyone to view sync operation logs. Logs could contain sensitive information like user UUIDs and operation details.
Changes
backend/controllers/get_logs.go:backend/models/logs.go:backend/main.go:Test plan
🤖 Generated with Claude Code