Skip to content

docs(#2342): the admin routes this middleware claims to protect no longer exist here - #2531

Merged
dcccrypto merged 1 commit into
playgroundfrom
fix/2474-2342-api-hardening
Sep 2, 2026
Merged

docs(#2342): the admin routes this middleware claims to protect no longer exist here#2531
dcccrypto merged 1 commit into
playgroundfrom
fix/2474-2342-api-hardening

Conversation

@dcccrypto

Copy link
Copy Markdown
Owner

Closes #2342 — by establishing that its premise no longer holds, and fixing the stale assurance that made it look like it did.

The premise

#2342 asks for a middleware guard on /admin as defence-in-depth, because "if any future admin route forgets to call requireAdminSession(), it's immediately exploitable without authentication."

There is no admin surface in this repo any more:

app/admin does not exist
app/api/admin/* does not exist
built route manifest no /admin entry
requireAdminSession zero callers outside its own test

It moved to the separate API service. There is no route here to forget the check.

What was actually wrong

The middleware still asserts:

• Every /api/admin/* route gates on requireAdminSession(req) server-side, so even if the page leaked HTML the data is locked down.

A reader checking that claim finds nothing to check. It is a security assurance about handlers that are not here — the same shape as nft#160's docs citing a LiteSVM suite that did not exist, and the parity spec naming a field the program had renamed. An unverifiable assurance is worse than an absent one, because it stops the next person looking.

The isAdminRoute branch is kept deliberately: if an /admin path is ever re-added, it inherits the security headers rather than silently skipping them. That is now stated as its actual purpose rather than implied.

And a note on the ask itself

A middleware guard could not have satisfied #2342 as written anyway — the Privy session is attached by useAdminFetch as a header and cannot be verified in the Edge runtime without bundling the SDK. That is why the guard lives in the handlers. Recorded so the next person does not re-attempt it.

Launch suite: 3128 passed / 16 skipped / 0 failed.

🤖 Generated with Claude Code

https://claude.ai/code/session_01NgoNgagkvw7i5SSRC3FJ8D

…nger exist here

#2342 asks for a middleware-level guard on /admin as defence-in-depth, on the
grounds that "if any future admin route forgets to call requireAdminSession it's
immediately exploitable without authentication".

The premise does not hold, and the reason is worth writing down rather than just
closing the issue.

There is no admin surface in this repo any more:

  app/admin              — does not exist
  app/api/admin/*        — does not exist
  built route manifest   — no /admin entry
  requireAdminSession    — ZERO callers outside its own test

The admin surface moved to the separate API service. So there is no route here to
forget the check.

What remains is worse than a gap in one specific way, which is what this commit
fixes. The middleware still asserts:

    • Every /api/admin/* route gates on requireAdminSession(req) server-side,
      so even if the page leaked HTML the data is locked down.

A reader checking that claim finds nothing to check. It is a security assurance
about handlers that are not here — the same shape as nft#160's docs citing a
LiteSVM suite that did not exist, and the parity spec naming a field the program
had renamed. An assurance nobody can verify is worse than an absent one, because
it stops the next person looking.

The isAdminRoute branch is kept deliberately: if an /admin path is ever re-added,
it inherits the security headers rather than silently skipping them. That is now
stated as its actual purpose.

Also recorded: a middleware guard could not have satisfied #2342 as asked anyway
— the Privy session is attached by useAdminFetch as a header and cannot be
verified in the Edge runtime without bundling the SDK, which is why the guard
lives in the handlers in the first place.

Launch suite: 3128 passed / 16 skipped / 0 failed.

Refs: #2342

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NgoNgagkvw7i5SSRC3FJ8D
@vercel

vercel Bot commented Sep 2, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
percolator-launch Ready Ready Preview Sep 2, 2026 6:37pm UTC
percolator-mainnet Ready Ready Preview Sep 2, 2026 6:37pm UTC
percolator-playground Ready Ready Preview Sep 2, 2026 6:37pm UTC

Request Review

@coderabbitai

coderabbitai Bot commented Sep 2, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 39 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Team

Run ID: dcb2841d-d948-4cda-b0fc-33a6a4dccf82

📥 Commits

Reviewing files that changed from the base of the PR and between f308f45 and 9c44768.

📒 Files selected for processing (1)
  • app/middleware.ts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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