react-doctor icon indicating copy to clipboard operation
react-doctor copied to clipboard

fix: support member expressions in containsAuthCheck

Open cr4yfish opened this issue 6 months ago • 3 comments

Support member expressions for server auth rule

Fixes this case:

await auth0.getSession() // Currently undetected

// Current workaround
const getSession = async () => await auth0.getSession()
await getSession() // Gets detected

I just added an else if to catch that - small diff.

Closes #239


[!NOTE] Low Risk Low risk, localized change to AST pattern matching for auth-check detection; main risk is minor false positives/negatives in linting rather than runtime behavior.

Overview Updates containsAuthCheck in server-auth-actions.ts to treat member-expression calls like auth0.getSession() (and awaited variants) as valid auth checks, in addition to direct identifier calls such as getSession().

Reviewed by Cursor Bugbot for commit 48965d85ef20a461a8953184bf96d3ffb471e64a. Bugbot is set up for automated code reviews on this repo. Configure here.

cr4yfish avatar May 14 '26 15:05 cr4yfish

🔴 React Review — 0/100 (unchanged) · No new issues

Reviewed by react-review for commit 48965d85ef20a461a8953184bf96d3ffb471e64a. Configure here.

react-doctor[bot] avatar May 14 '26 15:05 react-doctor[bot]

@cr4yfish is attempting to deploy a commit to the Million Team on Vercel.

A member of the Team first needs to authorize it.

vercel[bot] avatar May 14 '26 15:05 vercel[bot]

Working on a related fix in #261 that uses the existing getCalleeName utility instead of adding a parallel else if branch — it already resolves both Identifier and MemberExpression callees to a single name, so chained members (supabase.auth.getSession()), optional chaining (auth0?.getSession()), and the original Identifier forms all collapse into one check. Thanks for the report and repro — your test case is locked into the regression suite there.

NisargIO avatar May 16 '26 01:05 NisargIO