diff --git a/CHANGELOG.md b/CHANGELOG.md index 30b76670d..0a210e1c1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -40,6 +40,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - Fixed dirty context [PR #1328](https://github.com/3scale/APIcast/pull/1328) [THREESCALE-8000](https://issues.redhat.com/browse/THREESCALE-8000) [THREESCALE-8007](https://issues.redhat.com/browse/THREESCALE-8007) [THREESCALE-8252](https://issues.redhat.com/browse/THREESCALE-8252) - Fixed dirty context (part 2 of PR #1328) when tls termination policy is in the policy chain [PR #1333](https://github.com/3scale/APIcast/pull/1333) - Fixed NGINX filters policy error [PR #1339](https://github.com/3scale/APIcast/pull/1339) [THREESCALE-7349](https://issues.redhat.com/browse/THREESCALE-7349) +- Fix to avoid uninitialized variables when request URI is too large [PR #1340](https://github.com/3scale/APIcast/pull/1340) [THREESCALE-7906](https://issues.redhat.com/browse/THREESCALE-7906) ### Added diff --git a/gateway/conf.d/apicast.conf b/gateway/conf.d/apicast.conf index 2eaa845cd..c968acdee 100644 --- a/gateway/conf.d/apicast.conf +++ b/gateway/conf.d/apicast.conf @@ -156,7 +156,6 @@ location / { set $ctx_ref -1; - set $post_action_impact ''; set $original_request_id $request_id; set $original_request_uri '$scheme://$host$request_uri'; diff --git a/gateway/http.d/apicast.conf.liquid b/gateway/http.d/apicast.conf.liquid index 0276aa722..724bb5bc4 100644 --- a/gateway/http.d/apicast.conf.liquid +++ b/gateway/http.d/apicast.conf.liquid @@ -14,6 +14,13 @@ map "" $extended_access_logs_enabled { default '0'; } +map "" $post_action_impact { + default ''; +} + +map "" $target_host { + default '$host'; +} log_format extended escape=none '$extended_access_log'; diff --git a/t/apicast-log.t b/t/apicast-log.t index 78d1f20fb..c2762dce9 100644 --- a/t/apicast-log.t +++ b/t/apicast-log.t @@ -5,6 +5,16 @@ use Test::APIcast::Blackbox 'no_plan'; # stderr to be able to use "grep_error_log" by setting APICAST_ACCESS_LOG_FILE $ENV{APICAST_ACCESS_LOG_FILE} = "$Test::Nginx::Util::ErrLogFile"; +sub large_param { + my $res = ""; + for (my $i=0; $i <= 1024; $i++) { + $res = $res . "aaaaaaaaaa"; + } + return $res; +} + +$ENV{'LARGE_PARAM'} = large_param(); + repeat_each(2); run_tests(); @@ -131,3 +141,26 @@ yay, api backend: test:$TEST_NGINX_SERVER_PORT qr/\+0000\] localhost\:\d+ 127\.0\.0\.1\:\d+/ --- no_error_log [error] + + +=== TEST 4: large URI is handled correctly without leaving variables uninitialized. +--- configuration +{ + "services": [ + { + "id": 42, + "proxy": { + "proxy_rules": [ + { "pattern": "/", "http_method": "GET", "metric_system_name": "hits", "delta": 2 } + ] + } + } + ] +} +--- request eval +"GET /?user_key=value&large_param=$ENV{LARGE_PARAM}" +--- error_code: 414 +--- no_error_log eval +[ + qr/using uninitialized \"\w+\" variable while logging request/ +]