-
Notifications
You must be signed in to change notification settings - Fork 28
Description
📝 Task Description
Describing: This task does proposes adding detailed logging to the authorizeRoles middleware of the project. The goal is to improve debugging and security auditing by recording essential information whenever an authenticated user is denied access to a protected route due to insufficient permissions. Thus helping with securing user data and app safety.
🎯 Goal
The goal is to improve security and debugging by adding a logging feature to record every unauthorized access attempt on the backend.
🛠 Steps to Complete
-
Using Winston library for logging stuff
-
Creating a Logger Utility: A central module to initialize and configure the logger, which allows for consistent use across the application.
-
then Integrate into Middleware: Add a logger.warn() statement within the authorizeRoles middleware.
-
Log Key Data: The log will capture the user ID, their role, the required roles, and the route they attempted to access.
-
Using .env: An environment variable will be used to control the logging level, allowing for different levels of detail in various environments (e.g., development vs. production).
⏳ Expected Completion Time
1 Day at 7 Sep before 6:30 pm IST
@devayanm I am a part of OSCI'25 and would like to work on this issue. Please assign me so that i can enhance the project. I have already half worked on this and I will simultaneously send you pull request as time is running.