Skip to content

Conversation

@remus-iesan-natterbox
Copy link

@remus-iesan-natterbox remus-iesan-natterbox commented Sep 16, 2025

This pull request addresses BAU-28227 by introducing several security hardening measures to mitigate path traversal and related vulnerabilities in the Codeception codebase. The following core changes were made:

Summary of Changes

  1. Path Validation and Sanitization

    • Added strict validation and realpath checks for output, log, and database file paths to ensure they remain within the project directory.
    • Introduced helper methods (sanitizePath, sanitizeFilename, etc.) to centralize path validation across modules.
  2. Directory and File Handling Improvements

    • Updated logic for creating and writing to directories and files to use safe, validated paths.
    • Ensured that directory creation, permission checks, and file operations throw exceptions when invalid or insecure paths are detected.
  3. Module Updates

    • Filesystem Module: Enhanced file and directory access methods with path sanitization, preventing access outside the project directory.
    • Sqlite Driver: File operations (cleanup, snapshot, load) now strictly use sanitized filenames within the allowed scope.
    • Configuration: Output and log directories are validated, and any detected path traversal results in a configuration exception.

List of Modified Files

  • src/Codeception/Command/GenerateScenarios.php: Added realpath validation for scenario output paths.
  • src/Codeception/Configuration.php: Hardened output/log directory path handling; added project directory checks.
  • src/Codeception/Lib/Driver/Sqlite.php: Updated file operations to ensure database files remain within the project directory.
  • src/Codeception/Module/Filesystem.php: Introduced and utilized sanitizePath for all filesystem operations.

Iesan Remus and others added 2 commits September 15, 2025 15:33
@natterbox-integration
Copy link

natterbox-integration commented Sep 16, 2025

🎉 Snyk checks have passed. No issues have been found so far.

security/snyk check is complete. No issues have been found. (View Details)

license/snyk check is complete. No issues have been found. (View Details)

code/snyk check is complete. No issues have been found. (View Details)

Copy link

@orca-security-eu orca-security-eu bot left a comment

Choose a reason for hiding this comment

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

Orca Security Scan Summary

Status Check Issues by priority
Passed Passed Infrastructure as Code high 0   medium 0   low 0   info 0 View in Orca
Passed Passed SAST high 0   medium 0   low 0   info 0 View in Orca
Passed Passed Secrets high 0   medium 0   low 0   info 0 View in Orca
Passed Passed Vulnerabilities high 0   medium 0   low 0   info 0 View in Orca

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