mirror of
https://github.com/archtechx/tenancy.git
synced 2026-09-20 11:14:03 +00:00
Exercise the valid asset path before testing traversal
Request photo.jpg and assert success before asserting rejection of ../media-originals/photo.jpg (addresses https://github.com/archtechx/tenancy/pull/1479#pullrequestreview-4984403598)
This commit is contained in:
parent
e70057e3ba
commit
802022a926
1 changed files with 4 additions and 0 deletions
|
|
@ -404,6 +404,10 @@ test('tenant asset controller throws an exception when accessing a file in a dir
|
|||
|
||||
Storage::disk('media')->put('photo.jpg', 'public file');
|
||||
|
||||
pest()->get(tenant_asset('photo.jpg'), [
|
||||
'X-Tenant' => $tenant->id,
|
||||
])->assertSuccessful();
|
||||
|
||||
// A directory next to the asset root, e.g. one holding files that shouldn't be served
|
||||
mkdir($privateDirectory = storage_path('app/media-originals'), recursive: true);
|
||||
file_put_contents($privateDirectory . '/photo.jpg', 'private file');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue