Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EZP-31519: Moved app.php rejection snippet from front controller to ezpublish-kernel #514

Merged
merged 1 commit into from
Apr 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion doc/apache2/vhost.2.2.template
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
RewriteRule ^/(css|js|fonts?)/.*\.(css|js|otf|eot|ttf|svg|woff) - [L]

# Prevent access to website with direct usage of app.php in URL
RewriteRule ^/(.+/)?app\.php - [R=404,L]
RewriteRule ^/([^/]+/)?app\.php([/?#]|$) - [R=404,L]

RewriteRule .* /app.php
</IfModule>
Expand Down
2 changes: 1 addition & 1 deletion doc/apache2/vhost.template
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
RewriteRule ^/(css|js|fonts?)/.*\.(css|js|otf|eot|ttf|svg|woff) - [L]

# Prevent access to website with direct usage of app.php in URL
RewriteRule ^/(.+/)?app\.php - [R=404,L]
RewriteRule ^/([^/]+/)?app\.php([/?#]|$) - [R=404,L]

RewriteRule .* /app.php
</IfModule>
Expand Down
2 changes: 1 addition & 1 deletion doc/nginx/ez_params.d/ez_rewrite_params
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ rewrite "^/bundles/(.*)" "/bundles/$1" break;
rewrite "^/assets/(.*)" "/assets/$1" break;

# Prevent access to website with direct usage of app.php in URL
if ($request_uri ~ "^/(.+/)?app\.php") {
if ($request_uri ~ "^/([^/]+/)?app\.php([/?#]|$)") {
return 404;
}

Expand Down
8 changes: 0 additions & 8 deletions web/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,6 @@

$request = Request::createFromGlobals();

// Deny request if it contains the frontcontroller script ie. http://example.com/app.php
$frontControllerScript = preg_quote(basename($request->server->get('SCRIPT_FILENAME')));
if (preg_match("<^/([^/]+/)?$frontControllerScript([/?#]|$)>", $request->getRequestUri(), $matches) === 1) {
http_response_code(400);
echo('<html><head><title>400 Bad Request</title></head><body><h1>400 Bad Request</h1></center></body></html>');
die;
}

// If you are behind one or more trusted reverse proxies, you might want to set them in SYMFONY_TRUSTED_PROXIES environment
// variable in order to get correct client IP
if ($trustedProxies = getenv('SYMFONY_TRUSTED_PROXIES')) {
Expand Down