Skip to content

fix(security): add path traversal protections to telemetry CSV validation - #5663

Merged
priti-parate merged 3 commits into
dell:stagingfrom
SAYUK09:fix/telemetry-csv-path-traversal
Nov 2, 2026
Merged

priti-parate merged 3 commits into
dell:stagingfrom
SAYUK09:fix/telemetry-csv-path-traversal

Conversation

@SAYUK09

@SAYUK09 SAYUK09 commented Oct 30, 2026

Copy link
Copy Markdown
Collaborator

Description of the Solution

The validate_csv_structure() function in the telemetry validate_input module accepted attacker-controlled file paths without proper validation, allowing local file disclosure via symlinks or absolute/relative path traversal (CWE-22, CWE-59). An attacker with network access to the telemetry service could supply crafted csv_file_path values pointing to arbitrary files (e.g. /etc/passwd), whose contents would be echoed into logs. This addresses finding from the penetration test report for the telemetry CSV validation path.

Related Issue

Changes

telemetry validate_input (src/telemetry/plugins/modules/validate_input.py)

  • Add _is_path_within() helper for strict path containment checks
  • Resolve symlinks via os.path.realpath() before any file operations
  • Reject symbolic links explicitly with os.path.islink()
  • Enforce path containment using _is_path_within() when allowed_dir is provided
  • Open the resolved real path instead of the raw user-supplied input
  • Pass allowed_dir=input_dir_path at the call site to constrain CSV files to the project input directory

Files Changed

File Change Type Description
src/telemetry/plugins/modules/validate_input.py Modified Add realpath resolution, symlink rejection, and path containment to validate_csv_structure()

Backward Compatibility

No breaking changes.

…tion

The validate_csv_structure() function accepted attacker-controlled file
paths without proper validation, allowing local file disclosure via
symlinks or absolute/relative path traversal (CWE-22, CWE-59).

Add the following security controls, mirroring the hardened pattern
already applied in the repo_manager validate_input module:

- Resolve symlinks via os.path.realpath() before file operations
- Reject symbolic links explicitly with os.path.islink()
- Enforce path containment with a new _is_path_within() helper
- Open the resolved real path instead of the raw user-supplied input
- Pass allowed_dir=input_dir_path at the call site to constrain CSV
  files to the project input directory

Signed-off-by: sayuri <sayuri.kamble@dell.com>
@priti-parate
priti-parate merged commit 86a7e76 into dell:staging Nov 2, 2026
15 checks passed
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.

3 participants