-
Notifications
You must be signed in to change notification settings - Fork 2k
fix: resolve TOCTOU symlink vulnerability in FileHandler gc and destroy #10298
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
1a71cbd
fix: nested transformer request scope leakage (#10281)
michalsn fdca44a
fix(database): use currentRow instead of customResultObject in getRow…
gr8man ad66efe
chore(deps-dev): update boundwize/structarmed requirement (#10291)
dependabot[bot] 431c7ab
chore(deps-dev): update boundwize/structarmed requirement (#10292)
dependabot[bot] 0f7df43
chore(deps): bump shivammathur/setup-php in / (#10293)
dependabot[bot] 63348db
fix: resolve TOCTOU symlink vulnerability in FileHandler gc and destroy
gr8man 7a34749
style: remove unused variable assign in tests
gr8man 202d879
chore: trigger CI
gr8man 4348e3d
chore: trigger CI
gr8man 92cbb2d
chore: trigger CI
gr8man de7470f
chore: trigger CI
gr8man File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| <?php | ||
|
|
||
| declare(strict_types=1); | ||
|
|
||
| /** | ||
| * This file is part of CodeIgniter 4 framework. | ||
| * | ||
| * (c) CodeIgniter Foundation <admin@codeigniter.com> | ||
| * | ||
| * For the full copyright and license information, please view | ||
| * the LICENSE file that was distributed with this source code. | ||
| */ | ||
|
|
||
| namespace Tests\Support\API; | ||
|
|
||
| use CodeIgniter\API\BaseTransformer; | ||
|
|
||
| /** | ||
| * Nested transformer used to verify that the root request's scope | ||
| * (fields/includes) does not leak into related resources. | ||
| */ | ||
| class ChildTransformer extends BaseTransformer | ||
| { | ||
| public function toArray(mixed $resource): array | ||
| { | ||
| return [ | ||
| 'child_id' => $resource['id'] ?? null, | ||
| 'status' => 'transformed', | ||
| ]; | ||
| } | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| <?php | ||
|
|
||
| declare(strict_types=1); | ||
|
|
||
| /** | ||
| * This file is part of CodeIgniter 4 framework. | ||
| * | ||
| * (c) CodeIgniter Foundation <admin@codeigniter.com> | ||
| * | ||
| * For the full copyright and license information, please view | ||
| * the LICENSE file that was distributed with this source code. | ||
| */ | ||
|
|
||
| namespace Tests\Support\API; | ||
|
|
||
| use CodeIgniter\API\BaseTransformer; | ||
|
|
||
| /** | ||
| * Root transformer used to verify that nested transformers do not inherit | ||
| * the root request's `fields`/`include` query state. | ||
| */ | ||
| class ParentTransformer extends BaseTransformer | ||
| { | ||
| public function toArray(mixed $resource): array | ||
| { | ||
| return [ | ||
| 'parent_id' => $resource['id'] ?? null, | ||
| ]; | ||
| } | ||
|
|
||
| /** | ||
| * Includes a single related child resource. | ||
| * | ||
| * @return array<string, mixed> | ||
| */ | ||
| protected function includeChildren(): array | ||
| { | ||
| return (new ChildTransformer())->transform(['id' => 99]); | ||
| } | ||
|
|
||
| /** | ||
| * Includes a collection of related child resources. | ||
| * | ||
| * @return list<array<string, mixed>> | ||
| */ | ||
| protected function includeChildrenCollection(): array | ||
| { | ||
| return (new ChildTransformer())->transformMany([ | ||
| ['id' => 77], | ||
| ['id' => 88], | ||
| ]); | ||
| } | ||
|
|
||
| /** | ||
| * Includes a single child while explicitly forwarding the request, opting | ||
| * the child into the request-derived scope even though it is nested. | ||
| * | ||
| * @return array<string, mixed> | ||
| */ | ||
| protected function includeExplicitChild(): array | ||
| { | ||
| $childRequest = clone request(); | ||
| $childRequest->setGlobal('get', ['fields' => 'child_id']); | ||
|
|
||
| return (new ChildTransformer($childRequest))->transform(['id' => 99]); | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Once
is_link()filters links out,filemtime()on a non-link equals thestat['mtime']- the wholelstat()call is unnecessary.