Skip to content

Conversation

remus-iesan-natterbox
Copy link

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

This PR addresses security and robustness improvements in Codeception by validating inputs and enhancing database cleanup in PostgreSQL driver logic.

Changes Introduced

1. Input Validation for Suite and Config Names

Files: Console.php & Shared/Config.php

  • Added regex validation for suite name and config file path to prevent invalid or potentially dangerous input.
  • Invalid suite/config values now result in error messages or exceptions.
  • Ensures only alphanumeric, underscore (_), dash (-), period (.), and forward slash (/) are allowed where appropriate.

2. Improved Bootstrap Path Handling

File: Console.php

  • Validates the bootstrap path is within the project root and exists before requiring it.
  • Outputs an error if the bootstrap file path is invalid.

3. Hardened PostgreSQL Cleanup Logic

File: Lib/Driver/PostgreSql.php

  • Refactored to use quote_ident for safer SQL identifier handling in DROP statements.
  • Gathers tables, sequences, and enum types in the public schema and issues DROP statements for them.
  • Each DROP execution is wrapped in a try-catch block; failures are logged but do not stop the cleanup process.
  • Improves reliability and reduces risk of SQL injection or accidental incorrect execution.

@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.

2 participants