Unit/System Tests Information Required PR-5.4-dev Pending

User tests: Successful: Unsuccessful:

avatar arib06
arib06
1 Oct 2026

Pull Request resolves # .

  • I read the Generative AI policy and my contribution is either not created with the help of AI or is compatible with the policy and GNU/GPL 2 or later.

Summary of Changes

InputFilter::isSafeFile() scans uploaded file contents in 131072-byte chunks and, between chunks, kept only the last 10 bytes to reconnect a signature that lands on a read boundary. The longest signature it searches for, the __HALT_COMPILER() phar stub, is 17 bytes, so a stub straddling a chunk boundary is never matched and the file is reported safe. This keeps the last 16 bytes of each chunk instead, which is enough to reconnect that signature with the next chunk. Valid files are not affected.

Testing Instructions

Create a file that places __HALT_COMPILER() across the 131072-byte read boundary (131060 filler bytes, then the stub, then any trailing bytes) and run it through InputFilter::isSafeFile(). Every upload path that goes through Joomla\CMS\Input\Files or Joomla\CMS\Filesystem\File::upload() reaches this scanner. A regression test is included:

./libraries/vendor/bin/phpunit tests/Unit/Libraries/Cms/Filter/InputFilterTest.php

Actual result BEFORE applying this Pull Request

The file with the split phar stub passes the scanner (isSafeFile() returns true); the test case "stub straddling a read boundary" fails.

Expected result AFTER applying this Pull Request

The split phar stub is detected the same as a contiguous one (isSafeFile() returns false); the test passes.

Link to documentations

Please select:

  • Documentation link for guide.joomla.org:

  • No documentation changes for guide.joomla.org needed

  • Pull Request link for manual.joomla.org:

  • No documentation changes for manual.joomla.org needed

avatar arib06 arib06 - open - 1 Oct 2026
avatar arib06 arib06 - change - 1 Oct 2026
Status New ⇒ Pending
avatar joomla-cms-bot joomla-cms-bot - change - 1 Oct 2026
Category ⇒ Libraries Unit Tests
avatar richard67
richard67 - comment - 1 Oct 2026

@arib06 You have noticed that there is already a PR for the same thing? See #47952 . A simple text search for "phar" in the PR list on GitHub would have shown that.

The same question for that PR also applies to this one here: #47952 (comment)

How do you manage to upload a phar file in Joomla in practice?

avatar brianteeman
brianteeman - comment - 1 Oct 2026

just close it

avatar arib06
arib06 - comment - 2 Oct 2026

You're right, this duplicates #47952 which already covers the boundary carry-over more generally. Closing this one. On the practical question: the phar extension is blocked, so the value here is only the content scan catching a stub embedded in an otherwise-allowed file, and that's the same scope #47952 is already discussing, so no reason to keep a second PR open for it.

avatar arib06 arib06 - change - 2 Oct 2026
Status Pending ⇒ Closed
Closed_Date 0000-00-00 00:00:00 ⇒ 2026-10-02 13:33:16
Closed_By ⇒ arib06
Labels Added: Unit/System Tests Information Required PR-5.4-dev
avatar arib06 arib06 - close - 2 Oct 2026

Add a Comment

Login with GitHub to post a comment