fix(security): Phase 0 β close IDOR, source leak, broken update, filter injection - #122
Merged
Merged
Conversation
β¦efresh, Knip false positives)
β¦er injection - P0-1: Add ownership checks to subscription update/delete (IDOR) - P0-2: Stop serving frontend/src as static files (source disclosure) - P0-3: Fix transaction update payload (was sending raw id, dropping fields) - P0-4: Validate date/duration query params before NocoDB filter interpolation Adds regression tests for subscription IDOR, transaction update payload, date filter injection guard, and forecast duration clamp.
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.
Phase 0 β Security & Data Integrity
Closes the four P0 findings from the 4-agent senior-engineer code audit (see
reports/code-audit.md).Fixes
updateSubscription/deleteSubscriptionnow fetch the record and verifyuser_id === req.user.uidbefore mutating (403 on mismatch). Previously any authenticated user could modify/delete any other user's subscription by ID. Mirrors the existingsavingsGoalControllerownership pattern.express.static(frontend/src)fromapp.js. The entire Vue source tree (components, services, stores) was being served verbatim. Onlydist/is now served.updateTransactionwas callingupdateRecord(tableId, id, updatedData)but the service signature isupdateRecord(tableId, data)β the validated fields were silently dropped and the PATCH body was the raw id string. Now sends{ Id: id, ...updatedData }.startDate/endDateare now validated withvalidateAndFormatDatebefore interpolation into NocoDB filter strings (transactionService+ all 3 report endpoints).durationin the cash-flow forecast is clamped to 1β365 to prevent the unbounded per-day simulation CPU DoS.Tests added (90 passing, +0 failures)
subscriptionController.test.jsβ IDOR: cross-user update/delete β 403, service not calledtransactionController.test.jsβ update sends object payload (not raw id), cross-user β 403transactionService.test.jsβ filter-injection guard, invalid endDate β 400, validated dates in where clausecashFlowController.test.jsβ duration default 30, clamp to 365, clamp negative to 1Verification
pnpm testβ 90 passingeslint backend/**/*.jsβ cleanapp.jsloads without errorNotes
docs: document intentional design choices) is onmainseparately.