Skip to content

Conversation

andypols
Copy link
Contributor

Summary

This PR builds on #1090 by ensuring consistency in how user data is serialised and returned across multiple authentication-related endpoints.

Changes

The following endpoints now return user data using the same public-facing serialisation object introduced in PR #1090:

  • POST /auth/login — returns the user upon successful login
  • GET /auth/profile — returns the authenticated user
  • GET /auth/me — returns the authenticated user

I Introduced a new loginSuccessHandler function to encapsulate the login success logic. This allows for easier unit testing of login behavior independently of Passport's internal flow.

Note: /auth/profile and /auth/me currently serve the same purpose and return identical responses. Consolidating or removing one of these is a potential cleanup task, but is out of scope for this PR.

Copy link

netlify bot commented Jul 10, 2025

Deploy Preview for endearing-brigadeiros-63f9d0 canceled.

Name Link
🔨 Latest commit 40df0d1
🔍 Latest deploy log https://app.netlify.com/projects/endearing-brigadeiros-63f9d0/deploys/68750f9ee05e2500081a7136

@andypols andypols changed the title Fix additional user api leaks fix: additional user api leaks Jul 10, 2025
@github-actions github-actions bot added the fix label Jul 10, 2025
Copy link

codecov bot commented Jul 10, 2025

Codecov Report

Attention: Patch coverage is 88.88889% with 2 lines in your changes missing coverage. Please review.

Project coverage is 77.40%. Comparing base (4956b73) to head (40df0d1).
Report is 6 commits behind head on main.

Files with missing lines Patch % Lines
src/service/routes/auth.js 84.61% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1098      +/-   ##
==========================================
- Coverage   77.40%   77.40%   -0.01%     
==========================================
  Files          55       56       +1     
  Lines        2293     2288       -5     
  Branches      258      258              
==========================================
- Hits         1775     1771       -4     
+ Misses        488      487       -1     
  Partials       30       30              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Contributor

@jescalada jescalada left a comment

Choose a reason for hiding this comment

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

LGTM! 🚀

A bit of manual testing to confirm:
image

@jescalada jescalada merged commit c7d94a9 into finos:main Jul 14, 2025
14 of 15 checks passed
@andypols andypols deleted the fix-additional-user-api-leaks branch July 16, 2025 21:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants