Commit 782a934
committed
Fix multi-tenancy security vulnerability in OrdersController#show
The show action was not verifying that the order belongs to the
current store, allowing users to view orders from other stores if
they knew the order UUID.
The fix ensures that:
- Orders with a store_id must belong to the current_store_id
- Orders without a store_id (unassigned drafts) are accessible
- Orders from other stores return 404 Not Found
Added integration test to prevent regression.1 parent 61394da commit 782a934
File tree
2 files changed
+22
-2
lines changed- apps/rails_application
- app/controllers
- test/integration
2 files changed
+22
-2
lines changedLines changed: 4 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
8 | 7 | | |
9 | 8 | | |
10 | | - | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
11 | 13 | | |
12 | 14 | | |
13 | 15 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
335 | 335 | | |
336 | 336 | | |
337 | 337 | | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
338 | 356 | | |
339 | 357 | | |
340 | 358 | | |
| |||
0 commit comments