diff --git a/.htaccess b/.htaccess index 0ad7be30481..5248bd85d61 100644 --- a/.htaccess +++ b/.htaccess @@ -3,7 +3,7 @@ # # Protect files and directories from prying eyes. - + Require all denied diff --git a/core/modules/system/src/Tests/System/HtaccessTest.php b/core/modules/system/src/Tests/System/HtaccessTest.php new file mode 100644 index 00000000000..29f133d9390 --- /dev/null +++ b/core/modules/system/src/Tests/System/HtaccessTest.php @@ -0,0 +1,41 @@ +assertNoFileAccess('core/core.services.yml'); + // Try accessing a core module YAML file. + $this->assertNoFileAccess('core/modules/system/system.services.yml'); + } + + /** + * Asserts that a file exists but not accessible via HTTP. + * + * @param $path + * Path to file. Without leading slash. + */ + protected function assertNoFileAccess($path) { + $this->assertTrue(file_exists(DRUPAL_ROOT . '/' . $path)); + $this->drupalGet($path); + $this->assertResponse(403); + } + +} diff --git a/web.config b/web.config index b71c37cdcb7..b072d9b02db 100644 --- a/web.config +++ b/web.config @@ -22,7 +22,7 @@ - +