fix: apply showMemberMiddleware to flowsheet write routes#187
Open
jakebromberg wants to merge 4 commits intomainfrom
Open
fix: apply showMemberMiddleware to flowsheet write routes#187jakebromberg wants to merge 4 commits intomainfrom
jakebromberg wants to merge 4 commits intomainfrom
Conversation
The middleware was imported but never applied, allowing any authenticated DJ to modify flowsheet entries regardless of show membership. Co-authored-by: Cursor <cursoragent@cursor.com>
0f349db to
f392fe2
Compare
added 3 commits
February 27, 2026 14:03
The showMemberMiddleware checks req.auth for the user ID, but when AUTH_BYPASS=true the requirePermissions middleware skips JWT verification and never sets req.auth. This caused all flowsheet write routes to return 400 in integration tests. Follow the same AUTH_BYPASS pattern used by requirePermissions.
Use beforeEach to clear AUTH_BYPASS before each test and afterAll to restore it once after the suite. The previous afterEach approach restored AUTH_BYPASS to 'true' between tests in CI, causing later tests to hit the bypass path instead of exercising the middleware.
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.
Summary
showMemberMiddlewarewas imported inapps/backend/app.tsbut never applied to any route, allowing any authenticated DJ to modify flowsheet entries even without joining the active show.showMemberMiddlewareafterrequirePermissionson the POST, PATCH, and DELETE flowsheet routes inflowsheet.route.ts. Removed the unused import fromapp.ts..filter().lengthto.some().Test plan
showMemberMiddlewarecovering:next()Fixes #10
Made with Cursor