Skip to content

refine tokenFile write logic #2272

@andyzhangx

Description

@andyzhangx

azureOAuthTokenFile := filepath.Join(defaultAzureOAuthTokenDir, clientID+accountName)

The file path is constructed by directly concatenating clientID and accountName without any sanitization or validation. If clientID contains path traversal characters like "../" or if it's empty, this could lead to unexpected file paths issues. Consider validating clientID for invalid characters or using a safer path construction method like filepath.Clean() after ensuring clientID is non-empty.

What happened:

What you expected to happen:

How to reproduce it:

Anything else we need to know?:

Environment:

  • CSI Driver version:
  • Kubernetes version (use kubectl version):
  • OS (e.g. from /etc/os-release):
  • Kernel (e.g. uname -a):
  • Install tools:
  • Others:

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions