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

Enhance Profile Endpoint Robustness and Security in profile.js #327

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

Conversation

smog-root
Copy link
Contributor

@smog-root smog-root commented Oct 29, 2024

Issue: #323

Kindly add all the labels! and assign me! @Harshdev098

Changes:

1. Error Handling in display Function:

  • Added a check for empty results in the display function to avoid potential undefined errors when accessing result[0].
  • If no data is found, the function now returns a 404 Not Found response.

2. Asynchronous Support in updateProfile:

  • Wrapped db.query in a Promise to enable full asynchronous support with async/await, improving compatibility for future refactoring.

3. Token Security:

  • Removed any logging of sensitive token information to align with security best practices, especially for production environments.

4. Optimized SQL Query Syntax:

  • Switched from INNER JOIN to LEFT JOIN in the display function to ensure users without entries in the info_table are included if applicable.

5. Connection Management:

  • Utilized a try...finally block to ensure connection.release() is always called in display, preventing potential connection leaks.

Testing:

  • Tested for both existing and non-existing users to confirm proper responses (200 OK for valid users and 404 Not Found for invalid).
  • Verified that sensitive token data is not logged.
  • Confirmed that asynchronous calls work as expected with the new Promise wrapping in updateProfile.

Copy link
Owner

@Harshdev098 Harshdev098 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its not working perfectly

image

@smog-root
Copy link
Contributor Author

I will work on it!!. I'm in clg now. I will submit by night!!

@smog-root
Copy link
Contributor Author

smog-root commented Oct 29, 2024

@Harshdev098 everything is working ok!

The issue is raising because of another PR merge!

The site does not redirect to the pages!!

There is nothing i can do about it!! figure it you self!!

https://research-nexas.netlify.app/public

Screenshot 2024-10-29 170850

@smog-root
Copy link
Contributor Author

smog-root commented Oct 31, 2024

@Harshdev098 ???

Are you working on it?!

@smog-root
Copy link
Contributor Author

@Harshdev098 relpy??

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.

2 participants