Skip to content

feat(nextjs): Automatically skip middleware requests for tunnel route #16812

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

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

chargome
Copy link
Member

@chargome chargome commented Jul 4, 2025

#16626 added the option to generate a randomly generated tunnel route per build. This PR adds functionality for automatically skipping tunnel route requests in the nextjs middleware, as this had to be set up manually by the user until now.

@chargome chargome self-assigned this Jul 4, 2025
const isTunnelRequest = url.pathname.startsWith(tunnelRoute);

if (isTunnelRequest) {
return NextResponse.next() as ReturnType<H>;

Choose a reason for hiding this comment

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

High severity vulnerability may affect your project—review required:
Line 44 lists a dependency (next) with a known High severity vulnerability.

ℹ️ Why this matters

Affected versions of next are vulnerable to Improper Authorization. Improper authorization handling in Next.js applications enables attackers to bypass security controls for paths directly under the application's root directory, potentially exposing sensitive data or functionality. This issue affects versions prior to Next.js 14.2.15, where authorization logic based solely on pathname fails to account for certain direct page accesses.

References: GHSA, CVE

To resolve this comment:
Check if you use authorization to protect a page directly under the application's root directory (for example, https://example.com/foo) and you do NOT host your application on Vercel.

  • If you're affected, upgrade this dependency to at least version 14.2.15 at yarn.lock.
  • If you're not affected, comment /fp we don't use this [condition]
💬 Ignore this finding

To ignore this, reply with:

  • /fp <comment> for false positive
  • /ar <comment> for acceptable risk
  • /other <comment> for all other reasons

You can view more details on this finding in the Semgrep AppSec Platform here.

@chargome chargome marked this pull request as ready for review July 4, 2025 13:24
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