Skip to content

Commit d1ee696

Browse files
committed
Merge remote-tracking branch 'upstream/develop' into 4.7
2 parents a850820 + 4c833be commit d1ee696

File tree

7 files changed

+145
-23
lines changed

7 files changed

+145
-23
lines changed

CHANGELOG.md

Lines changed: 53 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,60 @@
11
# Changelog
22

3-
## [v4.6.1](https://github.com/codeigniter4/CodeIgniter4/tree/v4.6.0) (2025-05-02)
3+
## [v4.6.2](https://github.com/codeigniter4/CodeIgniter4/tree/v4.6.2) (2025-07-26)
4+
[Full Changelog](https://github.com/codeigniter4/CodeIgniter4/compare/v4.6.1...v4.6.2)
5+
6+
### Security
7+
8+
* **ImageMagickHandler**: *Command Injection Vulnerability in ImageMagick Handler*
9+
Fixes a vulnerability relating to uses of `ImageMagickHandler`'s `resize()` or `text()` methods
10+
where an attacker can upload malicious filenames containing shell metacharacters that get executed when
11+
the image is processed or when text is added to the image.
12+
13+
See the [security advisory](https://github.com/codeigniter4/CodeIgniter4/security/advisories/GHSA-9952-gv64-x94c)
14+
for details. Credits to @vicevirus for reporting the issue.
15+
16+
### Fixed Bugs
17+
18+
* chore: add missing EscaperInterface to the AutoloadConfig by @michalsn in https://github.com/codeigniter4/CodeIgniter4/pull/9561
19+
* fix: remove service dependency from sanitize_filename() helper function by @michalsn in https://github.com/codeigniter4/CodeIgniter4/pull/9560
20+
* fix: use native PHP truthiness for condition evaluation in when()/whenNot() by @michalsn in https://github.com/codeigniter4/CodeIgniter4/pull/9576
21+
* fix: add error handling for corrupted cache files in `FileHandler` by @michalsn in https://github.com/codeigniter4/CodeIgniter4/pull/9586
22+
* fix: correct `getHostname()` fallback logic in `Email` class by @michalsn in https://github.com/codeigniter4/CodeIgniter4/pull/9587
23+
* fix: encapsulation violation in `BasePreparedQuery` class by @michalsn in https://github.com/codeigniter4/CodeIgniter4/pull/9603
24+
* fix: URI authority generation for schemes without default ports by @michalsn in https://github.com/codeigniter4/CodeIgniter4/pull/9605
25+
* fix: correct path parsing in `SiteURIFactory::parseRequestURI()` by @michalsn in https://github.com/codeigniter4/CodeIgniter4/pull/9613
26+
* fix: support for multibyte folder names when the app is served from a subfolder by @michalsn in https://github.com/codeigniter4/CodeIgniter4/pull/9615
27+
* fix: use correct 24-hour time format in development error page. by @ping-yee in https://github.com/codeigniter4/CodeIgniter4/pull/9628
28+
* fix: improve CURLRequest intermediate HTTP response handling by @michalsn in https://github.com/codeigniter4/CodeIgniter4/pull/9627
29+
* fix: ensure `make:test` works on Windows by @paulbalandan in https://github.com/codeigniter4/CodeIgniter4/pull/9635
30+
* fix: ensure `make:test` generates test files ending in `Test` by @paulbalandan in https://github.com/codeigniter4/CodeIgniter4/pull/9636
31+
* fix: `make:test` requires 3 inputs after entering an empty class name by @paulbalandan in https://github.com/codeigniter4/CodeIgniter4/pull/9637
32+
* fix: add filename parameters to inline Content-Disposition headers by @michalsn in https://github.com/codeigniter4/CodeIgniter4/pull/9638
33+
34+
### Refactoring
35+
36+
* refactor: add `system/util_bootstrap.php` to curb overreliance to `system/Test/bootstrap.php` by @paulbalandan in https://github.com/codeigniter4/CodeIgniter4/pull/9562
37+
* refactor: update places to use `system/util_bootstrap.php` by @paulbalandan in https://github.com/codeigniter4/CodeIgniter4/pull/9568
38+
* refactor: more accurate array PHPDocs of Cookie by @paulbalandan in https://github.com/codeigniter4/CodeIgniter4/pull/9569
39+
* refactor: use native phpdocs wherever possible by @paulbalandan in https://github.com/codeigniter4/CodeIgniter4/pull/9571
40+
* refactor: fix `notIdentical.alwaysTrue` error by @paulbalandan in https://github.com/codeigniter4/CodeIgniter4/pull/9579
41+
* refactor: fix phpstan errors in `Events` by @paulbalandan in https://github.com/codeigniter4/CodeIgniter4/pull/9580
42+
* refactor: fix non-booleans in if conditions by @paulbalandan in https://github.com/codeigniter4/CodeIgniter4/pull/9578
43+
* refactor: fix and micro-optimize code in `Format` by @paulbalandan in https://github.com/codeigniter4/CodeIgniter4/pull/9583
44+
* refactor: fix various phpstan errors in Log component by @paulbalandan in https://github.com/codeigniter4/CodeIgniter4/pull/9581
45+
* refactor: partial fix errors on Email by @paulbalandan in https://github.com/codeigniter4/CodeIgniter4/pull/9582
46+
* refactor: fix phpstan errors in `ResponseTrait` by @paulbalandan in https://github.com/codeigniter4/CodeIgniter4/pull/9591
47+
* refactor: precise PHPDocs for Autoloader by @paulbalandan in https://github.com/codeigniter4/CodeIgniter4/pull/9593
48+
* refactor: fix phpstan errors in mock classes by @paulbalandan in https://github.com/codeigniter4/CodeIgniter4/pull/9594
49+
* refactor: fix various phpstan errors in Cache by @paulbalandan in https://github.com/codeigniter4/CodeIgniter4/pull/9610
50+
* fix: apply rector rule TernaryImplodeToImplodeRector by @michalsn in https://github.com/codeigniter4/CodeIgniter4/pull/9614
51+
* refactor: `Console::showHeader()` call `date()` only once by @paulbalandan in https://github.com/codeigniter4/CodeIgniter4/pull/9616
52+
53+
## [v4.6.1](https://github.com/codeigniter4/CodeIgniter4/tree/v4.6.1) (2025-05-02)
454
[Full Changelog](https://github.com/codeigniter4/CodeIgniter4/compare/v4.6.0...v4.6.1)
555

656
### Fixed Bugs
57+
758
* fix(CURLRequest): multiple header sections after redirects by @ducng99 in https://github.com/codeigniter4/CodeIgniter4/pull/9426
859
* fix: set headers for CORS by @michalsn in https://github.com/codeigniter4/CodeIgniter4/pull/9437
960
* fix: upsert with composite unique index by @michalsn in https://github.com/codeigniter4/CodeIgniter4/pull/9454
@@ -13,6 +64,7 @@
1364
* fix: added "application/octet-stream" to the "stl" mime type in the M… by @Franky5831 in https://github.com/codeigniter4/CodeIgniter4/pull/9543
1465

1566
### Refactoring
67+
1668
* refactor: get upper first protocol only one call in Email by @ddevsr in https://github.com/codeigniter4/CodeIgniter4/pull/9449
1769
* refactor: PHPDocs in `env()` by @ddevsr in https://github.com/codeigniter4/CodeIgniter4/pull/9468
1870
* refactor: remove lowercase event name for logging by @ddevsr in https://github.com/codeigniter4/CodeIgniter4/pull/9483

phpdoc.dist.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<output>api/build/</output>
1111
<cache>api/cache/</cache>
1212
</paths>
13-
<version number="4.6.1">
13+
<version number="4.6.2">
1414
<api format="php">
1515
<source dsn=".">
1616
<path>system</path>

system/CodeIgniter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class CodeIgniter
5555
/**
5656
* The current version of CodeIgniter Framework
5757
*/
58-
public const CI_VERSION = '4.6.1';
58+
public const CI_VERSION = '4.6.2';
5959

6060
/**
6161
* App startup time.

tests/system/Images/ImageMagickHandlerTest.php

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -444,6 +444,67 @@ public function testImageReorientPortrait(): void
444444
}
445445
}
446446

447+
public function testCommandInjectionPrevention(): void
448+
{
449+
$injectionFile = 'ci4_security_test.txt';
450+
$maliciousFilename = 'image.png`echo 123456 | tee ' . $injectionFile . '`';
451+
$tempPath = $this->root . $maliciousFilename;
452+
453+
$source = $this->origin . 'rocket.png';
454+
455+
if (file_exists($injectionFile)) {
456+
unlink($injectionFile);
457+
}
458+
459+
file_put_contents($tempPath, file_get_contents($source));
460+
461+
try {
462+
$this->handler->withFile($tempPath);
463+
$this->handler->resize(50, 50);
464+
} catch (ImageException) {
465+
$this->fail('Command injection succeeded. Fix is incomplete.');
466+
} finally {
467+
// Check that the command injection file was NOT created
468+
$this->assertFileDoesNotExist($injectionFile);
469+
470+
// Verify the image processing still works normally
471+
$this->assertSame(50, $this->handler->getWidth());
472+
$this->assertSame(50, $this->handler->getHeight());
473+
474+
if (file_exists($tempPath)) {
475+
unlink($tempPath);
476+
}
477+
}
478+
}
479+
480+
public function testCommandInjectionPreventionWithText(): void
481+
{
482+
$injectionFile = 'ci4_security_test.txt';
483+
$tempFilename = 'image.png';
484+
$tempPath = $this->root . $tempFilename;
485+
486+
$source = $this->origin . 'rocket.png';
487+
488+
if (file_exists($injectionFile)) {
489+
unlink($injectionFile);
490+
}
491+
492+
file_put_contents($tempPath, file_get_contents($source));
493+
494+
try {
495+
$this->handler->withFile($tempPath);
496+
$text = "Hello'; echo 123456 > {$injectionFile}; echo 'World";
497+
$this->handler->text($text);
498+
} finally {
499+
// Check that the command injection file was NOT created
500+
$this->assertFileDoesNotExist($injectionFile);
501+
502+
if (file_exists($tempPath)) {
503+
unlink($tempPath);
504+
}
505+
}
506+
}
507+
447508
public function testClearMetadataEnsuresResource(): void
448509
{
449510
$this->expectException(ImageException::class);

user_guide_src/source/changelogs/v4.6.2.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Version 4.6.2
33
#############
44

5-
Release Date: Unreleased
5+
Release Date: July 26, 2025
66

77
**4.6.2 release of CodeIgniter4**
88

@@ -11,12 +11,12 @@ Release Date: Unreleased
1111
:depth: 3
1212

1313
********
14-
BREAKING
14+
SECURITY
1515
********
1616

17-
***************
18-
Message Changes
19-
***************
17+
- **ImageMagick Handler:** *Command Injection Vulnerability in ImageMagick Handler* was fixed.
18+
See the `Security advisory GHSA-9952-gv64-x94c <https://github.com/codeigniter4/CodeIgniter4/security/advisories/GHSA-9952-gv64-x94c>`_
19+
for more information.
2020

2121
*******
2222
Changes

user_guide_src/source/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
version = '4.6'
2727

2828
# The full version, including alpha/beta/rc tags.
29-
release = '4.6.1'
29+
release = '4.6.2'
3030

3131
# -- General configuration ---------------------------------------------------
3232

user_guide_src/source/installation/upgrade_462.rst

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,6 @@ Please refer to the upgrade instructions corresponding to your installation meth
1212
:local:
1313
:depth: 2
1414

15-
**********************
16-
Mandatory File Changes
17-
**********************
18-
19-
****************
20-
Breaking Changes
21-
****************
22-
23-
*********************
24-
Breaking Enhancements
25-
*********************
26-
2715
*************
2816
Project Files
2917
*************
@@ -44,12 +32,33 @@ and it is recommended that you merge the updated versions with your application:
4432
Config
4533
------
4634

47-
- @TODO
35+
- app/Config/Autoload.php
36+
- app/Config/Cache.php
37+
- app/Config/Cookie.php
38+
- app/Config/DocTypes.php
39+
- app/Config/Logger.php
40+
- app/Config/Mimes.php
41+
- app/Config/Modules.php
42+
- app/Config/Optimize.php
43+
- app/Config/Paths.php
4844

4945
All Changes
5046
===========
5147

5248
This is a list of all files in the **project space** that received changes;
5349
many will be simple comments or formatting that have no effect on the runtime:
5450

55-
- @TODO
51+
- app/Config/Autoload.php
52+
- app/Config/Cache.php
53+
- app/Config/Cookie.php
54+
- app/Config/DocTypes.php
55+
- app/Config/Logger.php
56+
- app/Config/Mimes.php
57+
- app/Config/Modules.php
58+
- app/Config/Optimize.php
59+
- app/Config/Paths.php
60+
- app/Views/errors/html/debug.css
61+
- app/Views/errors/html/error_exception.php
62+
- preload.php
63+
- public/index.php
64+
- spark

0 commit comments

Comments
 (0)