Repository navigation
fix(manifests): scope manifest and stop lookups to the caller's company - #403
Merged
Merged
Conversation
The public API and console manifest controllers resolved manifests, stops and drivers by identifier alone, so any authenticated organization could read another's manifests and cancel, delete, re-sequence or complete its stops. Every lookup is now constrained to the session company; stops, which carry no company of their own, are owned through their manifest. A missing company session resolves nothing. Fixes GHSA-m8m5-5qhf-94rv and GHSA-q479-qp9q-mg27.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #403 +/- ##
===========================================
Coverage 100.00% 100.00%
- Complexity 13585 13590 +5
===========================================
Files 634 634
Lines 49308 49328 +20
===========================================
+ Hits 49308 49328 +20
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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
The manifest controllers resolved manifests, manifest stops and drivers by identifier alone, without constraining the query to the caller's company. Fleetbase has no global company scope, so these lookups could resolve another organization's records.
Api/v1/ManifestController):findManifest,findStop,findDriverRecordandmanifestsForare now scoped tosession('company'). Thepublic_id OR uuidmatch is grouped so the company constraint applies to both arms.Internal/v1/ManifestController):manifestQueryByPublicIdandmanifestStopQueryByPublicId, which backshow,cancel,destroy,showStopandupdateStop, are now scoped the same way.company_uuidcolumn, so they are owned through their manifest (whereHas('manifest', …)).1 = 0), followingscopedToCompanyinInternal/v1/OrderController.session('company')is set by core-apiAuthfor both API-credential and personal-token requests, so the driver app keeps resolving its own manifests.Fixes GHSA-m8m5-5qhf-94rv and GHSA-q479-qp9q-mg27.
Tests
public_idor byuuid. The endpoints answer 404 (public API) orModelNotFoundException(console), and nothing is written to the other company's rows. With no company session, nothing resolves.mainand pass on this branch.manifest_stopstable no longer has acompany_uuidcolumn that production lacks, so it can't mask a wrong fix.main.