Skip to content

JENKINS-62208 Prevent file contents from being printed during transfers#175

Merged
nrayapati merged 2 commits into
masterfrom
feature-JENKINS-62208
Dec 17, 2025
Merged

JENKINS-62208 Prevent file contents from being printed during transfers#175
nrayapati merged 2 commits into
masterfrom
feature-JENKINS-62208

Conversation

@nrayapati
Copy link
Copy Markdown
Member

Updated the defineRemote method to accept an enableInteraction flag, disabling interaction (and thus log piping) during file transfers in put and get methods. This prevents file contents from being printed to the logs, addressing a potential security and verbosity issue.

Description

See JENKINS-62208.

Submitter checklist

  • Link to JIRA ticket in description, if appropriate.
  • Change is code complete and matches issue description.
  • Appropriate unit or acceptance tests or explanation to why this change has no tests.
  • Reviewer's manual test instructions provided in PR description. See Reviewer's first task below.

Reviewer checklist

  • Run the changes and verified the change matches the issue description.
  • Reviewed the code.
  • Verified that the appropriate tests have been written or valid explanation given.
  • If applicable, test installing this plugin on the Jenkins instance.

Updated the defineRemote method to accept an enableInteraction flag, disabling interaction (and thus log piping) during file transfers in put and get methods. This prevents file contents from being printed to the logs, addressing a potential security and verbosity issue.
@nrayapati nrayapati requested a review from Copilot December 16, 2025 21:52
@nrayapati nrayapati self-assigned this Dec 16, 2025
@nrayapati nrayapati added the enhancement New feature or request label Dec 16, 2025
@nrayapati nrayapati requested a review from kirk-fitz December 16, 2025 21:54
Copy link
Copy Markdown

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

This PR addresses JENKINS-62208 by preventing file contents from being printed to Jenkins logs during SSH file transfers. The fix adds an enableInteraction flag to the defineRemote method, which when set to false, disables the interaction block that pipes output to logs.

  • Added optional enableInteraction parameter to defineRemote method with backward-compatible default value of true
  • Modified put and get methods to explicitly disable interaction during file transfers
  • Updated interaction block setup to be conditional based on the enableInteraction flag

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

Comment thread src/main/groovy/org/jenkinsci/plugins/sshsteps/SSHService.groovy
Comment thread src/main/groovy/org/jenkinsci/plugins/sshsteps/SSHService.groovy
Introduce security-focused tests in GetStepTest and PutStepTest to ensure that file transfer operations (get/put) do not leak file contents or sensitive information to the Jenkins console. These tests validate that the SSHService methods are called and that the security fix disabling interaction blocks during file transfers is effective.
@nrayapati
Copy link
Copy Markdown
Member Author

@kirk-fitz Would you be able to verif this incremental is working properly on your Jenkins? https://repo.jenkins-ci.org/incrementals/org/jenkins-ci/plugins/ssh-steps/2.0.89.vccd94d21c78a_/

@kirk-fitz
Copy link
Copy Markdown

@nrayapati glad to see some movement on it, not sure if you got to look at my previous pr
#158

It was not complete, but maybe you got inspiration from it, I will review and test over the coming days

@nrayapati
Copy link
Copy Markdown
Member Author

@nrayapati glad to see some movement on it, not sure if you got to look at my previous pr #158

It was not complete, but maybe you got inspiration from it, I will review and test over the coming days

Thanks for your earlier work on #158! I actually approached this differently - rather than filtering at runtime based on SCP mode and verbose flag, I disabled the interaction block entirely for all file transfer operations (both SCP and SFTP) at definition time via the enableInteraction parameter. This is more generic and prevents the issue at the source for sshGet, sshPut, and any future file transfer steps. The interaction block now only captures output for commands and scripts where users actually want to see the output. If anyone needs file transfer debugging, they can still use the remote.logLevel setting to enable groovy-ssh's internal logging separately.

Looking forward to your review and testing feedback! :)

@kirk-fitz
Copy link
Copy Markdown

Thanks for the detailed explanation, Your approach is cleaner and more robust. My PR was really a narrow fix aimed at suppressing the SCP output I was personally hitting, and it didn’t address SFTP or future transfer steps, nor did it come with tests.

Copy link
Copy Markdown

@kirk-fitz kirk-fitz left a comment

Choose a reason for hiding this comment

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

Changes look good, have tested locally

@nrayapati
Copy link
Copy Markdown
Member Author

Changes look good, have tested locally

Thank you very much!

@nrayapati nrayapati merged commit 3ec7101 into master Dec 17, 2025
15 checks passed
@nrayapati nrayapati deleted the feature-JENKINS-62208 branch December 17, 2025 14:17
@nrayapati
Copy link
Copy Markdown
Member Author

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

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants