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

Update Auth.js and solved some potential bugs. #9605

Open
wants to merge 1 commit into
base: alpha
Choose a base branch
from

Conversation

Ujjawal-Kantt
Copy link

Pull Request


Issue

Closes: Issue #XXXX


Approach

This PR fixes memory leaks, improves session management, enhances security, and optimizes authentication logic in the Auth.js file.

Key Changes:

  1. Fixed Memory Leak in throttle

    • Used a Map() to track session timeouts.
    • Cleared timeouts properly before setting new ones.
  2. Improved Role Fetching Mechanism

    • Ensured this.userRoles updates correctly.
    • Avoided redundant database calls when fetching user roles.
  3. Enhanced Session Token Management

    • Ensured missing sessionToken values are handled properly.
    • Added validation to check for expired session tokens before processing.
  4. Optimized Security Checks & Error Handling

    • Improved error logging for better debugging.
    • Ensured expired or invalid session tokens are rejected early.
  5. Updated renewSessionIfNeeded Logic

    • Reduced redundant session expiry updates.
    • Only updates session expiry when required, preventing unnecessary writes.

Tasks

  • Fix memory leaks in session handling.
  • Improve role-fetching logic.
  • Enhance error handling and security checks.
  • Add tests for updated authentication logic.
  • Update documentation to reflect session management improvements.
  • Add security check.
  • Add new Parse Error codes to Parse JS SDK (No hard-coded error codes in Parse Server).

Signed-off-by: Ujjawal Kantt <124806392+Ujjawal-Kantt@users.noreply.github.com>
Copy link

Thanks for opening this pull request!

  • ❌ Please link an issue that describes the reason for this pull request, otherwise your pull request will be closed. Make sure to write it as Closes: #123 in the PR description, so I can recognize it.

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.

1 participant