Skip to content

Potential fix for code scanning alert no. 1: Cleartext logging of sensitive information#6

Open
danielbodnar wants to merge 1 commit intomainfrom
alert-autofix-1
Open

Potential fix for code scanning alert no. 1: Cleartext logging of sensitive information#6
danielbodnar wants to merge 1 commit intomainfrom
alert-autofix-1

Conversation

@danielbodnar
Copy link
Contributor

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 username and then printing that full command with println!("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 raw ssh_command while 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 of ssh_command unchanged for execution. We will replace the println!("Running: {}", ssh_command); line with a more generic message that does not include username (or the entire command string). No new imports or external dependencies are required.

Suggested fixes powered by Copilot Autofix. Review carefully before merging.

…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>
@danielbodnar danielbodnar marked this pull request as ready for review March 18, 2026 19:10
Copilot AI review requested due to automatic review settings March 18, 2026 19:10
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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); with println!("Attempting direct SSH connection to {}:{}...", host, port);

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants