Repository navigation
Harden extra files staging in CommonTemplateJvmInitializer - #4676
Conversation
Codecov Report❌ Patch coverage is ❌ Your patch check has failed because the patch coverage (66.66%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #4676 +/- ##
============================================
+ Coverage 60.13% 60.34% +0.20%
- Complexity 8845 8973 +128
============================================
Files 1123 1126 +3
Lines 72848 73008 +160
Branches 8855 8881 +26
============================================
+ Hits 43808 44054 +246
+ Misses 26105 26021 -84
+ Partials 2935 2933 -2
🚀 New features to boost your workflow:
|
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request hardens the staging process for extra files in CommonTemplateJvmInitializer. By migrating to NIO.2 file operations and explicitly setting POSIX file permissions, the changes ensure that staged files and their parent directories are restricted to owner-only access, improving the security posture of the template initialization process. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request enhances security in CommonTemplateJvmInitializer (for both v1 and v2) by restricting directory and file permissions to owner-only when POSIX is supported, and updates SecretManagerServiceClient usage to a try-with-resources block. The review feedback correctly identifies potential Time-of-Check to Time-of-Use (TOCTOU) race conditions and temporary windows of loose permissions during directory and file creation. It is recommended to create these paths atomically with POSIX attributes directly using Files.createDirectories and Files.createFile (catching FileAlreadyExistsException if the file already exists) to ensure robust security.
|
R: @derrickaw |
Hardens extra files staging in
CommonTemplateJvmInitializer. See internal bug for details.Internal tracking: b/591510517