Skip to content

[Intl] Fixed directory traversal in emoji compression tool #51030

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

Merged
merged 1 commit into from
Jul 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/intl-data-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,11 @@ jobs:
run: |
[ -f src/Symfony/Component/Intl/Resources/data/locales/en.php ]
[ ! -f src/Symfony/Component/Intl/Resources/data/locales/en.php.gz ]
[ -f src/Symfony/Component/Intl/Resources/data/transliterator/emoji/emoji-en.php ]
[ ! -f src/Symfony/Component/Intl/Resources/data/transliterator/emoji/emoji-en.php.gz ]
src/Symfony/Component/Intl/Resources/bin/compress
[ ! -f src/Symfony/Component/Intl/Resources/data/locales/en.php ]
[ -f src/Symfony/Component/Intl/Resources/data/locales/en.php.gz ]
[ ! -f src/Symfony/Component/Intl/Resources/data/transliterator/emoji/emoji-en.php ]
[ -f src/Symfony/Component/Intl/Resources/data/transliterator/emoji/emoji-en.php.gz ]
./phpunit src/Symfony/Component/Intl
11 changes: 9 additions & 2 deletions src/Symfony/Component/Intl/Resources/bin/compress
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,15 @@ if (!extension_loaded('zlib')) {
throw new Exception('This script requires the zlib extension.');
}

foreach (glob(dirname(__DIR__).'/data/*/*.php') as $file) {
if ('meta.php' === basename($file)) {
$iterator = new RecursiveIteratorIterator(
new RecursiveDirectoryIterator(
dirname(__DIR__).'/data',
FilesystemIterator::CURRENT_AS_FILEINFO | FilesystemIterator::SKIP_DOTS
)
);

foreach ($iterator as $file) {
if ('php' !== $file->getExtension() || 'meta.php' === $file->getFilename()) {
continue;
}

Expand Down