Skip to content

Conversation

@mpatlasov
Copy link
Contributor

If the password to SMB-server contained special characters (e.g. "foo,bar"), the mount failed. Now, when the password is passed to mount via "credentials=filename" option, then mount succeeds.

/kind bug

Fixes #507, #358, #573

Release note:

none

@k8s-ci-robot k8s-ci-robot added kind/bug Categorizes issue or PR as related to a bug. release-note-none Denotes a PR that doesn't merit a release note. labels Jun 25, 2025
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jun 25, 2025
@k8s-ci-robot
Copy link
Contributor

Hi @mpatlasov. Thanks for your PR.

I'm waiting for a kubernetes-csi member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Jun 25, 2025
@mpatlasov mpatlasov force-pushed the Use-credentials-mount-option branch from a118c24 to a700858 Compare June 25, 2025 21:30
Copy link
Member

@andyzhangx andyzhangx left a comment

Choose a reason for hiding this comment

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

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jun 28, 2025
@andyzhangx
Copy link
Member

btw, sanity tests all failed with this PR: https://prow.k8s.io/view/gs/kubernetes-ci-logs/pr-logs/pull/kubernetes-csi_csi-driver-smb/961/pull-csi-driver-smb-sanity/1938798037342097408

@coveralls
Copy link

coveralls commented Jul 2, 2025

Pull Request Test Coverage Report for Build 16896083151

Details

  • 21 of 25 (84.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.05%) to 78.507%

Changes Missing Coverage Covered Lines Changed/Added Lines %
pkg/smb/smb_common_linux.go 13 17 76.47%
Totals Coverage Status
Change from base Build 16825067885: 0.05%
Covered Lines: 1125
Relevant Lines: 1433

💛 - Coveralls

@mpatlasov mpatlasov force-pushed the Use-credentials-mount-option branch from a700858 to d605781 Compare August 4, 2025 23:44
@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Aug 4, 2025
If the password to SMB-server contained special characters (e.g. "foo,bar"), the mount failed. Now, when the password is passed to mount via "credentials=filename" option, then mount succeeds.
@mpatlasov mpatlasov force-pushed the Use-credentials-mount-option branch from d605781 to 0cbf17f Compare August 4, 2025 23:59
@mpatlasov
Copy link
Contributor Author

/test pull-csi-driver-smb-e2e-windows-2022

@mpatlasov
Copy link
Contributor Author

@andyzhangx , I addressed your comments (and fixed test failures). Please take a look again.

@andyzhangx andyzhangx requested review from Copilot and removed request for ZeroMagic August 6, 2025 03:40
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

This PR fixes a bug where SMB volume mounting fails when passwords contain special characters like commas, quotes, or backticks. The solution switches from passing credentials directly in the mount command line to writing them to a temporary credentials file when special characters are detected.

  • Adds detection for special characters in passwords that could break mount command parsing
  • Implements credentials file approach as fallback when special characters are present
  • Modifies mount options format to support both direct and file-based credential passing

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.

File Description
pkg/smb/smb_common_linux.go Adds credential file creation logic and special character detection for mount options
pkg/smb/nodeserver.go Adds special character detection function and modifies credential formatting based on character presence

Copy link
Member

@andyzhangx andyzhangx left a comment

Choose a reason for hiding this comment

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

thanks, it lgtm in general now.

@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Aug 12, 2025
@mpatlasov
Copy link
Contributor Author

Hey @andyzhangx , I made three changes in a new commit:

  • Moved defer func to L44 (as you suggested here)
  • Added new test-case to existing TestNodeStageVolume to dive into Mount() "if NeedsCredentialsOption() {..."
  • Added new file smb_common_linux_test.go with tests for NeedsCredentialsOption()

@mpatlasov mpatlasov force-pushed the Use-credentials-mount-option branch from a03aa0d to 5d48318 Compare August 12, 2025 01:00
@andyzhangx
Copy link
Member

/retest

1 similar comment
@andyzhangx
Copy link
Member

/retest

Copy link
Member

@andyzhangx andyzhangx left a comment

Choose a reason for hiding this comment

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

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 12, 2025
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: andyzhangx, mpatlasov

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 12, 2025
@k8s-ci-robot k8s-ci-robot merged commit 86b088e into kubernetes-csi:master Aug 12, 2025
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. release-note-none Denotes a PR that doesn't merit a release note. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

support passwords containing comma character

6 participants