chore: disable build_python_zip#3612
Conversation
Summary of ChangesHello @rickeylev, 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 primarily focuses on refining Bazel build configurations for Python rules, with a significant emphasis on disabling implicit Python zip creation and improving Windows compatibility. It introduces a more robust mechanism for handling Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
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 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 counter productive. 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. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request disables implicit Python zip creation by default across .bazelrc files and updates related configurations. A critical security concern was identified in a PowerShell script, where overly permissive file permissions granted to "Everyone" could lead to information leakage in shared build environments. Furthermore, while the supporting code changes are well-executed and improve robustness, especially for Windows, documentation for the new //command_line_option feature is suggested to enhance usability and maintainability.
python/private/build_data_writer.ps1
Outdated
| $Acl = Get-Acl $OutputPath | ||
| $AccessRule = New-Object System.Security.AccessControl.FileSystemAccessRule("Everyone", "Read", "Allow") | ||
| $Acl.SetAccessRule($AccessRule) | ||
| Set-Acl $OutputPath $Acl |
There was a problem hiding this comment.
The script explicitly sets the Access Control List (ACL) of the output build data file to allow "Everyone" read access. This is overly permissive and violates the Principle of Least Privilege. In a shared environment, such as a multi-user CI server or a shared development machine, any user on the system can read the contents of this file.
While the file primarily contains build metadata (target name, config mode, etc.), it also includes the contents of the workspace status files (VERSION_FILE and INFO_FILE). These files can contain sensitive information depending on the user's workspace status script configuration.
Consider removing this ACL change or using a more restrictive group such as "Authenticated Users" if explicit permissions are necessary.
$Acl = Get-Acl $OutputPath
$AccessRule = New-Object System.Security.AccessControl.FileSystemAccessRule("Authenticated Users", "Read", "Allow")
$Acl.SetAccessRule($AccessRule)
Set-Acl $OutputPath $Acl
| # todo: add docs, xref with config_settings | ||
| # rules_python target, config_setting processing code converts it to the | ||
| # Bazel-builtin //command_line_label:build_runfile_links psuedo-target | ||
| alias( | ||
| name = "build_runfile_links", | ||
| actual = "//python:none", | ||
| ) | ||
|
|
||
| # todo: add docs | ||
| alias( | ||
| name = "enable_runfiles", | ||
| actual = "//python:none", | ||
| ) |
There was a problem hiding this comment.
The new aliases build_runfile_links and enable_runfiles have todo: add docs comments. It would be beneficial to add this documentation as part of this PR to make the new feature easier for users to understand. The documentation could explain what these aliases are for, how they relate to the Bazel built-in command line options, and include a cross-reference to config_settings as noted in the comment.
| :::{default-domain} bzl | ||
| ::: | ||
| :::{bzl:currentfile} //command_line_option:BUILD.bazel | ||
| ::: | ||
|
|
||
| # //command_line_option |
b806a1d to
9a93f27
Compare
8b335c5 to
cf5e26c
Compare
.bazelrc changes that disable --build_python_zip
DO NOT MERGE: await #3611