Skip to content

fix: skip response.headers.set() in GET handler side-effect check (#206)#211

Open
PranavAgarkar07 wants to merge 1 commit into
millionco:mainfrom
PranavAgarkar07:fix/206-side-effect-false-positive
Open

fix: skip response.headers.set() in GET handler side-effect check (#206)#211
PranavAgarkar07 wants to merge 1 commit into
millionco:mainfrom
PranavAgarkar07:fix/206-side-effect-false-positive

Conversation

@PranavAgarkar07
Copy link
Copy Markdown

@PranavAgarkar07 PranavAgarkar07 commented May 12, 2026

Summary

Fixes a false positive in nextjsNoSideEffectInGetHandler where response.headers.set() was flagged as a side effect in GET route handlers.

Setting response headers is a legitimate and expected operation in Next.js GET route handlers — it does not represent a CSRF-vulnerable write. This PR adds an isHeadersChainCall helper that excludes .headers.set() (and any .headers.*() mutation) from the DB mutation check in findSideEffect.

Closes #206


Note

Low Risk
Low risk: small, localized change to AST side-effect detection logic to reduce false positives, with minimal impact outside GET-handler lint diagnostics.

Overview
Prevents nextjsNoSideEffectInGetHandler (and other rules using findSideEffect) from flagging response.headers.*() calls as “DB mutations” in GET handlers.

Adds an isHeadersChainCall AST helper and uses it to exclude any call whose member chain includes .headers from the isMutatingDbCall branch in findSideEffect, fixing the response.headers.set() false positive.

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

@reactreview
Copy link
Copy Markdown

reactreview Bot commented May 12, 2026

Note

No issues found

@vercel
Copy link
Copy Markdown

vercel Bot commented May 12, 2026

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

A member of the Team first needs to authorize 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.

False positive: nextjs-no-side-effect-in-get-handler flags Response.headers.set() and similar Headers API calls

1 participant