From 46567174cfcd6e6f176211aa7caef950f07559fb Mon Sep 17 00:00:00 2001 From: Qi Date: Mon, 12 Aug 2024 17:20:46 +0800 Subject: [PATCH] fix(kong.tools.http): ensure the `EMPTY` table returned by `parse_directive_header` is readonly (#13491) Panic on writing the EMPTY table * Fix https://github.com/Kong/kong/pull/13458 * https://konghq.atlassian.net/browse/KAG-5139? --- kong/tools/http.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kong/tools/http.lua b/kong/tools/http.lua index 7101470e0e5d..ef3839739000 100644 --- a/kong/tools/http.lua +++ b/kong/tools/http.lua @@ -1,5 +1,6 @@ local pl_path = require "pl.path" local pl_file = require "pl.file" +local pl_tblx = require "pl.tablex" local type = type @@ -23,7 +24,7 @@ local lower = string.lower local max = math.max local tab_new = require("table.new") -local EMPTY = {} +local EMPTY = pl_tblx.readonly({}) local _M = {}