Problem/Motivation
PHP 8.0 no longer has phar vulnerability ref #3181240-5: Upgrade typo3/phar-stream-wrapper 3.1.6
The TYPO3/phar-stream-wrapper still used in 9.x core because it supports PHP 7.3
Proposed resolution
remove all usages and library dependency ASAP after core will require 8.0 as minimal version
Remaining tasks
- check all usage
- remove all usages of the library (code and composer dependencies)
- patch
- review/commit
User interface changes
no
API changes
tbd
Data model changes
no
Release notes snippet
Drupal 10 core no longer depends on the TYPO3/phar-stream-wrapper library, because this library is only needed for PHP 7.3 and earlier.
Comments
Comment #2
andypostcould need change record
Comment #3
andypostUsage is
-
\Drupal\Core\Security\PharExtensionInterceptorneeds class deprecation-
\Drupal\Core\DrupalKernel::boot()- just removalComment #4
gábor hojtsyThis cannot happen in Drupal 9 as Drupal 9 will not require PHP 8. However Drupal 10 will require PHP 8 according to current plans, so moving there.
Comment #5
gábor hojtsyComment #6
andypostComment #9
spokjeAlthough the tests (will) return green, this doesn't feel right to me.
\Drupal\Core\Security\PharExtensionInterceptoris not used anywhere any more (was only used in\Drupal\Core\DrupalKernel::boot()and not in any test classes).- Adding a deprecation that's never triggered doesn't seem right.
- Leaving a file (
core/lib/Drupal/Core/Security/PharExtensionInterceptor.php) that has undefined classes (YPO3\PharStreamWrapper\*can't be loaded sincetypo3/phar-stream-wrapperis no longer pulled in) doesn't seem right.Personally I would rather do #3181275: Do not register Phar stream wrapper on PHP 8 because it is not vulnerable to unserialize bugs first and deprecate
\Drupal\Core\Security\PharExtensionInterceptorthere in 9.4.0 and remove in 10.0.0.Putting this on Needs Review anyway to get more eyes/minds/random body-parts on this.
Comment #10
longwaveDo we need a deprecation at all? Can we consider PharExtensionInterceptor as internal as it's a very specialist class that was only used by our kernel?
Comment #11
spokje@longwave: Like that idea, but since it wasn't tagged as
@internal, there _could_ be Contrib/Custom modules out there using it (although I think the chances are pretty slim on that)Doing a search on
PharExtensionInterceptorin Contrib reveals no usage: http://grep.xnddx.ru/search?text=PharExtensionInterceptor&filename=Since this is a case that's not really (fully) covered by the Drupal deprecation policy, maybe we can get away with just removing it?
Comment #12
andypost++ to mark internal in separate issue with CR
Comment #13
spokjeThus spoketh @andypost in #12
I think that would be a very nice solution!
Opened #3252406: Mark class \Drupal\Core\Security\PharExtensionInterceptor as internal to mark
\Drupal\Core\Security\PharExtensionInterceptorin9.4.x, so we can remove it without deprecation here after that issue lands.Comment #14
spokjePostponing on #3252406: Mark class \Drupal\Core\Security\PharExtensionInterceptor as internal
Comment #15
alexpottComment #16
longwaveComment #18
longwaveDeleted a bit too much.
Comment #19
alexpottLooking at this now I realise that this should be
$this->assertFileDoesNotExist()No harm in tweaking that here.
Comment #20
alexpottActually ignore #19. I think we can remove \Drupal\KernelTests\Core\File\PharWrapperTest and core/tests/fixtures/files/phar-1.phar - this fixture is now only testing the default stream wrapper that comes with PHP and I don't think we should be testing that.
The whole assert on
$this->assertFileDoesNotExist("phar://$base/image-2.jpg/index.php");is pretty bogus for PHP 8. We're not doing user-land phar file stream wrappers and we have no code that's doing anything in this space - ie we're removing \Drupal\Core\Security\PharExtensionInterceptor and the Typo3 code.Comment #21
longwaveIn that case #16 was right all along.
@alexpott what do think about removing
StreamWrapperTest::testPharStreamWrapperRegistration()as well? I think that only exists because of the Typo3 interceptor.Comment #22
longwave#16 with the removal of
StreamWrapperTest::testPharStreamWrapperRegistration()as well. One of the comments mentions PharStreamWrapperManager, that is now gone.Comment #23
alexpottCan also remove
core/tests/fixtures/files/phar-1.pharComment #24
spokjeComment #25
andypostLooks ready
Comment #27
catchCommitted 9f5c2e9 and pushed to 10.0.x. Thanks!
Comment #28
xjmOh nice, I hadn't thought about the fact that we don't need it anymore. Yay!
Remember to tag dependency changes for the release notes.
Comment #29
xjm