From 1331dc91563d72fde392757ab3f2a93fac46a19b Mon Sep 17 00:00:00 2001 From: Eloy Coto Date: Fri, 28 Feb 2020 17:28:30 +0100 Subject: [PATCH] Policy::Logging: Fix crash on invalid config. If the logging config is not correct,operations are not defined,the loop will not work and it'll crash. Fix #1165 Fix THREESCALE-4605 Signed-off-by: Eloy Coto --- CHANGELOG.md | 1 + gateway/src/apicast/policy/logging/logging.lua | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4d5f64986..04c4fd4be 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ## [3.8.0-alpha2] - 2019-02-18 - Fixed naming issues in policies [THREESCALE-4150](https://issues.jboss.org/browse/THREESCALE-4150) [PR #1167](https://github.com/3scale/APIcast/pull/1167) +- Fixed issues on invalid config in logging policy [THREESCALE-4605](https://issues.jboss.org/browse/THREESCALE-4605) [PR #1168](https://github.com/3scale/APIcast/pull/1168) ## [3.7.0-alpha2] diff --git a/gateway/src/apicast/policy/logging/logging.lua b/gateway/src/apicast/policy/logging/logging.lua index 25fd9f2d9..62ea9db5a 100644 --- a/gateway/src/apicast/policy/logging/logging.lua +++ b/gateway/src/apicast/policy/logging/logging.lua @@ -56,7 +56,7 @@ function _M:load_condition(config) ngx.log(ngx.DEBUG, 'Enabling extended log with conditions') local operations = {} - for _, operation in ipairs(config.condition.operations) do + for _, operation in ipairs(config.condition.operations or {}) do table.insert( operations, Operation.new( operation.match, operation.match_type,