# Grav CMS Test Structure - Updated ## Directory Layout Overview ``` /test1/cms/grav/ ├── .git/ - Git folder tests (blocked) │ └── secret.txt ├── .well-known/ - Well-known directory (allowed exception) │ └── robots.txt ├── .htaccess - Main Apache rules configuration ├── .htpasswd - Hidden file (blocked by Rule 5) ├── bin/ - Bin folder tests (blocked) │ └── helper.php ├── backup/ - Backup folder tests (blocked) │ └── archive.zip ├── cache/ - Cache folder tests (blocked) │ └── test.txt ├── composer.json - Config file protection (blocked) ├── composer.lock - Config file protection (blocked) ├── existing.jpg - Existing file for routing test (200 OK) ├── index.php - Grav CMS entry point - routes non-existing files │ - Returns: "Grav CMS Content Route" page ├── LICENSE.txt - Config file protection (blocked) ├── logs/ - Logs folder tests (blocked) │ └── app.log ├── normal-page.md - Normal Grav CMS page (routes through index.php) ├── README.md - This documentation file ├── somedir/ - Empty directory for routing test (200 OK) ├── system/ - System folder tests (blocked extensions) │ └── config.xml ├── vendor/ - Vendor folder tests (blocked extensions) │ └── module.txt ├── user/ - User folder tests (blocked extensions) │ ├── test.txt │ ├── data.json │ ├── template.twig │ ├── script.sh │ ├── module.php │ ├── config.yml │ └── settings.yaml ├── webserver-configs/ - Webserver configs folder tests (blocked) │ └── nginx.conf ├── tests/ - Tests folder tests (blocked) │ └── unit-test.php ├── test-mustache.php - Security: Mustache template injection pattern ├── twig-test.html - Security: Twig syntax injection pattern ├── test-rewriterules.sh - Bash script to test all rules using curl └── README.md - Documentation ``` ## Updated Test Script Features ### New Content Verification Function The script now includes a `test_rule_content()` function that: 1. Checks HTTP status code matches expected value 2. Verifies response body contains expected content string **Example usage:** ```bash test_rule_content "Normal page routing via index.php" \ "$BASE_URL/normal-page/" \ "200" \ "Grav CMS Content Route" ``` This tests that: - URL `/home/alexey/projects/workspace-zed/test1/cms/grav/normal-page/` (non-existing file) - Returns HTTP 200 status (routed through index.php via Rule 2) - Response body contains "Grav CMS Content Route" text from index.php ## Test Coverage Summary ### 1. Security Rules - Malicious Patterns ✓ - Template injection: `{{ }}`, `{% %}` in URI/Query String → **403** - Base64 payloads: `base64_encode()` pattern → **403** - Script injection: `