Repository navigation
Conversation
There was a problem hiding this comment.
Code Review
This pull request enhances the security of ImageMagick-based image processing services across Cloud Functions (v1 and v2) and Cloud Run. It mitigates path traversal and argument injection vulnerabilities by replacing hardcoded temporary file paths with safely generated temporary files using Files.createTempFile and validating file extensions against a whitelist. It also ensures proper cleanup of temporary files using a try-finally block with Files.deleteIfExists. Additionally, the Cloud Run service is updated with documentation and comments recommending secure deployment using --no-allow-unauthenticated and IAM-authenticated Pub/Sub push subscriptions. There are no review comments, and I have no further feedback to provide.
5f387da to
e5684cf
Compare
Description
Harden path handling and file extension validation across the Java ImageMagick samples (
run/image-processing,functions/imagemagick, andfunctions/v2/imagemagick), and clarify Cloud Run Pub/Sub authentication setup inrun/image-processing/README.md.Changes
run/image-processing/src/main/java/com/example/cloudrun/PubSubController.java,run/image-processing/src/main/java/com/example/cloudrun/ImageMagick.java, andrun/image-processing/README.md(--no-allow-unauthenticatedguidance and safe temporary file/extension handling).functions/imagemagick/src/main/java/functions/ImageMagick.javaandfunctions/v2/imagemagick/src/main/java/functions/ImageMagick.javato use temporary files and extension allowlisting.Checklist
Testing
mvn clean verifyrequired (awaiting CI;mvnunavailable in local environment)mvn -P lint checkstyle:checkrequiredmvn -P lint clean compile pmd:cpd-check spotbugs:checkadvisory onlyCompliance & Style
pom.xmlparent set to latestshared-configurationPost-Approval Actions