Repository navigation
Health: only real login checks in app.use() hide open Express endpoints (#72) - #85
Merged
haydenschmitty merged 1 commit intoNov 15, 2026
Conversation
…ts (haydenschmitty#72) An app-wide app.use(...) counted as a login check whenever any guard-like word appeared in its arguments, which turned off the open-endpoint check for every route behind it: - words inside strings, like a header named 'X-Refreshed-Token' in cors({ exposedHeaders: [...] }), are ignored - middleware that never turns anyone away (cors, helmet, express-session, passport.session(), body parsers...) is skipped - a name that only says "guard" (createShutdownGuard) needs a word saying what it checks (authGuard, requireUser, verifyToken) The arguments are now read with brackets balanced, so a real check listed after other middleware, as in app.use(cors(), requireUser), is found too; before, the match stopped at the first ")". The "None of your endpoints check who is calling" title no longer shows "." for a project that is a single repo at its root.
7 tasks done
3 tasks done
Owner
|
Merged and released in 0.9.0. Thank you! Update with |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this changes
Fixes #72. An app-wide
app.use(...)counted as a login check whenever any guard-like word appeared in its arguments, which turned off the open-endpoint check for every route behind it. In the issue's words, "No open endpoints" then looks like a clean result.Following the directions suggested in the issue:
'X-Refreshed-Token'incors({ exposedHeaders: [...] })no longer counts as a check.cors,helmet, body parsers,express.static,express-session,passport.session(), rate limiters and similar..use(). Because such a guard clears every route after it, the name must also say what it checks (authGuard,requireUser,verifyToken).createShutdownGuard()no longer counts.The arguments of
.use(...)are now read with brackets balanced, one argument at a time. Before, the match stopped at the first), so a real check listed after other middleware, as inapp.use(cors(), requireUser), was missed and those routes were reported as open. That case is now found too.It also fixes the small
.bug noted in the issue. For a project that is one repo at its root, the title now reads "None of your endpoints check who is calling". Issue ids are unchanged, so existing "Not a problem" choices still apply.I didn't change the shared
isGuardName, to stay clear of #73. Naming the app-wide guard in the Health panel, the issue's third suggestion, needs a UI change, so I've left it out of this PR. I'm happy to follow up if you'd like it.How I tested it
tests/express-global-guard.test.mjs, built on the issue's sample (TypeScript, Express, one repo):corsandexpress.jsonoptions don't count;session,passport.session()andhelmetdon't count;createShutdownGuard()doesn't count;requireAuth,authGuard,verifyToken(),jwt({...}), andcors(), requireUser;..@app.middleware("http")guard isn't recognised yet, but that's a separate FastAPI case, not touched here.)Checklist
npm testpasses (207 passed, 1 platform skip)claude plugin validate .passesCHANGELOG.mdupdated, if people will notice the change