docs(auth export): documment --unmasked flag#366
docs(auth export): documment --unmasked flag#366secustor wants to merge 2 commits intogoogleworkspace:mainfrom
Conversation
🦋 Changeset detectedLatest commit: eefbe52 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
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 focuses on enhancing the clarity and usability of the Highlights
Changelog
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 adds documentation for the --unmasked flag of the auth export command. The changes correctly document the flag in the help text and add a doc comment to the handle_export function. However, I've identified a critical security vulnerability in the handle_export function where it could leak unmasked secrets to stdout if the credential file is corrupted. I've left a comment with details on how to fix this.
src/auth_commands.rs
Outdated
| .map(|s| s.to_string()) | ||
| } | ||
|
|
||
| /// Export credentials to stdout |
There was a problem hiding this comment.
This function has a potential security vulnerability. When unmasked is false, it attempts to parse the decrypted credentials as JSON to mask secrets. However, if the JSON parsing fails (e.g., due to file corruption), the else block on line 426 will print the raw, unmasked contents to stdout. This could leak secrets.
Instead of printing the raw content on parsing failure, the function should return an error. For example:
// ...
} else {
match serde_json::from_str::<serde_json::Value>(&contents) {
Ok(mut creds) => {
// ... masking logic ...
println!("{}", serde_json::to_string_pretty(&creds).unwrap());
}
Err(e) => {
return Err(GwsError::Validation(format!("Failed to parse credentials for masking: {e}")));
}
}
}
// ...|
/gemini review |
Description
Document
--unmaskedflag forgws auth exportChecklist:
AGENTS.mdguidelines (no generatedgoogle-*crates).cargo fmt --allto format the code perfectly.cargo clippy -- -D warningsand resolved all warnings.pnpx changeset) to document my changes.