-
Notifications
You must be signed in to change notification settings - Fork 42
Fix Redis PECL installation during Docker builds #196
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -40,8 +40,13 @@ RUN docker-php-ext-install soap \ | |
| && docker-php-ext-install gmp | ||
|
|
||
| # Install Redis PHP extension | ||
| RUN pecl install redis \ | ||
| && docker-php-ext-enable redis | ||
| ARG REDIS_PECL_VERSION=6.3.0 | ||
|
|
||
| RUN curl -fsSL -o /tmp/redis.tgz \ | ||
| "https://pecl.php.net/get/redis-${REDIS_PECL_VERSION}.tgz" \ | ||
| && pecl install /tmp/redis.tgz \ | ||
| && docker-php-ext-enable redis \ | ||
| && rm -f /tmp/redis.tgz | ||
|
Comment on lines
+45
to
+49
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add checksum verification for the downloaded Redis tarball. The downloaded tarball is installed without verifying its checksum or signature. This creates a supply-chain security risk: if the download is tampered with (via compromised CDN, DNS hijacking, or man-in-the-middle), a malicious extension could be installed into the image. 🔒 Recommended fix to add SHA256 checksum verification ARG REDIS_PECL_VERSION=6.3.0
+ARG REDIS_PECL_SHA256=d6abeac798644a4f7e81e480f86b5e5e8c3a35cf
RUN curl -fsSL -o /tmp/redis.tgz \
"https://pecl.php.net/get/redis-${REDIS_PECL_VERSION}.tgz" \
+ && echo "${REDIS_PECL_SHA256} /tmp/redis.tgz" | sha256sum -c - \
&& pecl install /tmp/redis.tgz \
&& docker-php-ext-enable redis \
&& rm -f /tmp/redis.tgzNote: The SHA256 hash shown is a placeholder. Retrieve the actual checksum from the official PECL package page or by downloading and verifying the file manually. 🤖 Prompt for AI Agents |
||
|
|
||
| # Install Composer | ||
| RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add timeout configuration to the curl command.
The curl command has no timeout specified, which means the build could hang indefinitely if there's a network connectivity issue or if the PECL server becomes unresponsive.
⏱️ Recommended fix to add timeout flags
RUN curl -fsSL -o /tmp/redis.tgz \ + --connect-timeout 30 --max-time 300 \ "https://pecl.php.net/get/redis-${REDIS_PECL_VERSION}.tgz" \ && pecl install /tmp/redis.tgz \This sets a 30-second connection timeout and a 5-minute maximum time for the entire operation.
📝 Committable suggestion
🤖 Prompt for AI Agents