Skip to content

[release-1.35] cleanup: add folderName validation to reject invalid characters#3078

Merged
k8s-ci-robot merged 4 commits intokubernetes-sigs:release-1.35from
k8s-infra-cherrypick-robot:cherry-pick-3071-to-release-1.35
Apr 12, 2026
Merged

[release-1.35] cleanup: add folderName validation to reject invalid characters#3078
k8s-ci-robot merged 4 commits intokubernetes-sigs:release-1.35from
k8s-infra-cherrypick-robot:cherry-pick-3071-to-release-1.35

Conversation

@k8s-infra-cherrypick-robot
Copy link
Copy Markdown

This is an automated cherry-pick of #3071

/assign andyzhangx

Add folderName parameter validation to reject invalid characters (\:*?"<>|, control chars, directory traversal) before mount

Validate folderName parameter in both CreateVolume and NodeStageVolume
to reject characters not allowed in Azure file share folder names:
- Invalid characters: \ : * ? " < > |
- Control characters (0x00-0x1F)
- Directory traversal (..)
- Segments ending with period or space
- Empty path segments

Empty folderName is allowed. Folder name supports '/' as path separator
for nested folders.
- Use %q for folderName in error messages for clarity with whitespace/dots
- Also reject '.' as path segment (not just '..')
- Fix misleading test name 'valid single dot segment' -> 'invalid single dot segment'
- Add NodeStageVolume test for invalid folderName
- Add CreateVolume test for invalid folderName in storage class
Null bytes in folder names can truncate C strings at the OS layer,
leading to path injection risks. Add an early check before segment
parsing to explicitly reject null bytes with a clear error message.
@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Apr 11, 2026
@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Apr 11, 2026
Copy link
Copy Markdown
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 Apr 12, 2026
@k8s-ci-robot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: andyzhangx, k8s-infra-cherrypick-robot

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

The pull request process is described here

Details 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 Apr 12, 2026
@k8s-ci-robot k8s-ci-robot merged commit 1abd8e7 into kubernetes-sigs:release-1.35 Apr 12, 2026
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. lgtm "Looks good to me", indicates that a PR is ready to be merged. 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.

3 participants