Skip to content

chore: modify the kokoro dockerfile remove a PHP vulnerability - #9814

Closed
Hectorhammett wants to merge 2 commits into
mainfrom
patch-php-tests
Closed

Hectorhammett wants to merge 2 commits into
mainfrom
patch-php-tests

Conversation

@Hectorhammett

Copy link
Copy Markdown
Collaborator

There is a Remote code execution vulnerability discovered in PHP.

Went ahead and updated our workflow files and the kokoro docker file to ensure that we are using the patched versions of PHP and in the case that one of the workflows is using an unpatched version (Which should not be the case) it disables the feature that makes the vulnerability available as it is not a required feature for our workflows.

@Hectorhammett
Hectorhammett marked this pull request as ready for review October 23, 2026 00:04
@Hectorhammett
Hectorhammett requested a review from a team as a code owner October 23, 2026 00:04

@bshaffer bshaffer left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I only see value in the .kokoro/docs/docker/Dockerfile change, the CI changes do not seem necessary to me... we are running CLI, not a web server, so the PHP2Shell vulnerability does not apply.

FROM gcr.io/gcp-runtimes/ubuntu_20_0_4@sha256:666805a878d9cd58ce9dfd6f423e2d0e3bdf01eea0cddd2be3a88244c1d4dfa5
ENV PHP_DIR=/opt/php82
ENV PHP_VERSION=8.2.30
ENV PHP_VERSION=8.2.35

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is the most important change, and I feel like it should be in a separate PR so we can get it merged and released immediately

Comment on lines +25 to +26
env:
update: true

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does this do?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This forces the Php setup to update the PHP version.

If the docker image we are using contains a PHP version, using this will force to ignore the version it has and update it.

I added this because some images sometimes have an unpatched version and didn't want to depend on them to actually having the patched on.

php-version: '8.2'
tools: pecl
extensions: grpc
ini-values: session.upload_progress.enabled=0

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this seems a bit overkill if we know shivammathur/setup-php is using the most recent patched version

Comment on lines +60 to +70
- name: Verify PHP version
run: |
php -r '
$min = ["8.2" => "8.2.35", "8.3" => "8.3.36", "8.4" => "8.4.27", "8.5" => "8.5.12"];
$minor = PHP_MAJOR_VERSION . "." . PHP_MINOR_VERSION;
if (!isset($min[$minor]) || version_compare(PHP_VERSION, $min[$minor], "<")) {
fwrite(STDERR, sprintf("Unpatched PHP version %s detected (minimum required: %s)\n", PHP_VERSION, $min[$minor] ?? "8.2.35"));
exit(1);
}
echo "Verified patched PHP version: " . PHP_VERSION . PHP_EOL;
'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this seems a bit overkill since we know shivammathur/setup-php is using the most recent patched versions

@Hectorhammett

Copy link
Copy Markdown
Collaborator Author

Closing this PR as we decided to just extract the PHP version section into a different PR and merged that one instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants