fix(#242): harden access control and atomicity from code review#248
Merged
NickMonrad merged 1 commit intoMay 29, 2026
Merged
Conversation
- resourceTypes DELETE: scope deleteMany to projectId and 404 when no row matches, preventing cross-tenant resource type deletion (IDOR) - timeline PUT /:featureId: verify the feature belongs to the owned project before upserting, preventing cross-tenant timeline overwrites (IDOR) - namedResources POST/DELETE: wrap capacity-plan exit, create/delete and count re-sync in a single transaction to avoid count desync under concurrent requests Adds cross-tenant 404 tests for the resourceTypes DELETE and timeline PUT routes and updates mocks for the transactional named-resource flow. Note: the IPv6 rate-limit hardening (ipKeyGenerator) is deferred — the installed express-rate-limit@7.5.1 does not export that helper. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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
Fixes three findings from a code review of the timeline UX rework branch (#242): two cross-tenant access-control holes (IDOR) and a non-atomic count re-sync. Targets
feature/timeline-ux-reworkso the fixes land before #242 merges tomain.Related issue
Follow-up (deferred) items tracked in #247. Code-reviewed against #242.
Changes
DELETE /:id(IDOR, HIGH): scope the delete to the owned project viadeleteMany({ where: { id, projectId } })and return 404 when nothing matches. Previously deleted by global PK, letting any user delete another tenant's resource type.PUT /:featureId(IDOR, MEDIUM): verify the feature belongs to the owned project (feature.findFirst({ id, epic: { projectId } })) and 404 before thetimelineEntry.upsert, preventing cross-tenant timeline overwrites.POST/DELETE(reliability): wrap the capacity-plan exit, create/delete, andresourceType.countre-sync in a singleprisma.$transaction, passing the tx client toexitCapacityPlanForManualScheduling, eliminating the count-desync window under concurrent requests.setup.ts) for the transactional flow.E2E Tests
No client/UI behaviour changed — these are server-side authorization and atomicity fixes. No Playwright tests added or modified;
e2e/TESTS.mdunchanged.Tests added/modified:
server/src/test/resourceTypes.test.ts— added cross-tenant DELETE 404 test + project-scoped happy path; updated the capacity-plan-exit DELETE test to assert in-transaction behaviour.server/src/test/timeline.test.ts— added cross-tenant PUT 404 test (assertsupsertnever called); updated happy-path mock.Testing
npx tsc --noEmitpasses in/serverresourceTypes,timeline,namedResourceAssignments,auth— 44 tests)npx tsc --noEmitin/client— n/a (no client changes)npm run test:e2e— n/a (no UI changes)Notes
ipKeyGenerator) requires upgradingexpress-rate-limit— the installed7.5.1tree does not export that helper, so importing it would break the build.Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com