Potential fix for code scanning alert no. 1: Cleartext logging of sensitive information#6
Open
danielbodnar wants to merge 1 commit intomainfrom
Open
Potential fix for code scanning alert no. 1: Cleartext logging of sensitive information#6danielbodnar wants to merge 1 commit intomainfrom
danielbodnar wants to merge 1 commit intomainfrom
Conversation
…sitive information Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> Signed-off-by: Daniel Bodnar <1790726+danielbodnar@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Updates CLI output during VyOS connection testing to avoid printing the full SSH command and instead emit a higher-level connection attempt message.
Changes:
- Replaced
println!("Running: {}", ssh_command);withprintln!("Attempting direct SSH connection to {}:{}...", host, port);
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Potential fix for https://github.com/bitbuilder-io/bbctl/security/code-scanning/1
In general, to fix cleartext logging issues, remove sensitive data from logs or replace it with redacted versions or summaries. If the information must be logged, it should be masked or encrypted so that it is not directly usable by an attacker.
Here, the problematic behavior is constructing an SSH command string that embeds the untrusted
usernameand then printing that full command withprintln!("Running: {}", ssh_command);. The command is still executed, which is fine from a logging perspective; only the display is risky. The least invasive fix is to stop printing the rawssh_commandwhile still giving the user a helpful message. For example, we can log that we are attempting a direct SSH connection and mention the host and port, but omit the username or at least avoid echoing the exact shell command that will be run.Concretely, in
src/main.rs, around lines 405–407, we will keep the construction and use ofssh_commandunchanged for execution. We will replace theprintln!("Running: {}", ssh_command);line with a more generic message that does not includeusername(or the entire command string). No new imports or external dependencies are required.Suggested fixes powered by Copilot Autofix. Review carefully before merging.