Skip to content

Security for group access added succesfully#98

Merged
SudiptaPaul-31 merged 1 commit intoLumina-eX:mainfrom
Sadeequ:main
Mar 28, 2026
Merged

Security for group access added succesfully#98
SudiptaPaul-31 merged 1 commit intoLumina-eX:mainfrom
Sadeequ:main

Conversation

@Sadeequ
Copy link
Copy Markdown
Contributor

@Sadeequ Sadeequ commented Mar 25, 2026

Closes #92


closes #92
A new security utility has been created at /workspaces/AnonChat/lib/auth/group-access.ts to serve as a group access validation middleware.

This new file introduces a single function, validateGroupAccess, which is designed to be a reusable component for protecting group-specific API endpoints.

Here’s a breakdown of its functionality:

Dual-Layer Membership Validation: It first checks for direct wallet membership in the group_membership table. If that fails, it provides backward compatibility by checking if the wallet belongs to a user profile that is a member of the group via the room_members table.
Input Sanitization: It validates the roomId and the format of the walletAddress before proceeding.
Standardized Error Responses: It returns structured JSON error responses with appropriate HTTP status codes (400 for bad requests, 403 for unauthorized access, and 500 for server errors).
Security Logging: The middleware includes clear logging for unauthorized access attempts and database errors, which is crucial for auditing and debugging.

This implementation successfully creates a secure and efficient middleware component that aligns with the platform's security guidelines.

@drips-wave
Copy link
Copy Markdown

drips-wave bot commented Mar 25, 2026

@Sadeequ Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Sadeequ
Copy link
Copy Markdown
Contributor Author

Sadeequ commented Mar 28, 2026

Review my PR and close please.

@SudiptaPaul-31 SudiptaPaul-31 merged commit c3d1323 into Lumina-eX:main Mar 28, 2026
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.

Group Access Validation Middleware

2 participants