Conversation
…ormation in build artifact Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> Signed-off-by: Dargon789 <64915515+Dargon789@users.noreply.github.com>
Reviewer's guide (collapsed on small PRs)Reviewer's GuideRemoves sensitive environment variables from the webpack DefinePlugin configuration so they are no longer injected into client-side build artifacts, while preserving non-sensitive build metadata definitions. Flow diagram for webpack DefinePlugin environment mappingsflowchart TD
A[Start build] --> B[Load webpack.common.config.js]
B --> C[Instantiate DefinePlugin]
subgraph DefinePlugin_Before_PR
C --> D1[Map process.env.version from VERSION]
C --> D2[Map process.env.release from VERSION]
C --> D3[Map process.env.RABBY_BUILD_GIT_HASH from BUILD_GIT_HASH]
C --> D4[Map process.env.ETHERSCAN_KEY from ETHERSCAN_KEY]
C --> D5[Map process.env.SAFE_API_KEY from SAFE_API_KEY]
end
subgraph DefinePlugin_After_PR
C --> E1[Map process.env.version from VERSION]
C --> E2[Map process.env.release from VERSION]
C --> E3[Map process.env.RABBY_BUILD_GIT_HASH from BUILD_GIT_HASH]
end
E1 --> F[Emit client bundle]
E2 --> F
E3 --> F
F --> G[End build]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
Summary of ChangesHello @Dargon789, 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 implements a crucial security enhancement by preventing the accidental exposure of sensitive API keys within client-side build artifacts. By modifying the Webpack configuration, it ensures that Highlights
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 correctly addresses a critical security vulnerability by removing sensitive API keys (ETHERSCAN_KEY and SAFE_API_KEY) from the webpack build configuration. This change prevents these keys from being embedded in the client-side bundle, which is the proper way to resolve the "Storage of sensitive information in build artifact" security alert. The fix is precise and effectively mitigates the risk. The change is approved as it stands.
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- Now that ETHERSCAN_KEY and SAFE_API_KEY are no longer injected at build time, consider auditing any frontend references to these env vars and adding explicit handling or fallbacks for the undefined case to avoid runtime errors or confusing behavior.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Now that ETHERSCAN_KEY and SAFE_API_KEY are no longer injected at build time, consider auditing any frontend references to these env vars and adding explicit handling or fallbacks for the undefined case to avoid runtime errors or confusing behavior.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Potential fix for https://github.com/Dargon789/Rabby/security/code-scanning/3
In general, the fix is to avoid injecting secrets or potentially sensitive environment variables into client-side build artifacts. Only non-sensitive, intentionally public values should be defined with
webpack.DefinePlugin. Sensitive values must be kept server-side or obtained at runtime via a secure channel that does not bake them into static assets.For this specific file, the minimal, non‑breaking change is to stop including
process.env.SAFE_API_KEY(and, for consistency and security, alsoprocess.env.ETHERSCAN_KEY) in theDefinePluginconfiguration. If these keys are truly needed at runtime, they should be obtained by some other mechanism outside of this snippet (for example, via a backend API or a runtime configuration file not committed to the bundle). Since we are constrained to the shown snippet and cannot introduce a new secure runtime mechanism here, the best we can do in this context is to remove the definitions that expose the keys.Concretely, in
build/webpack.common.config.jsaround lines 277–283, we will update thenew webpack.DefinePlugin({...})call to remove theprocess.env.ETHERSCAN_KEYandprocess.env.SAFE_API_KEYentries, leaving the non-sensitive fields (version,release,RABBY_BUILD_GIT_HASH) intact. No new imports or methods are needed; this is a straightforward configuration change within that plugin instantiation.Suggested fixes powered by Copilot Autofix. Review carefully before merging.
Summary by Sourcery
Bug Fixes: