Skip to content

Commit 558fc7f

Browse files
authored
remove enriching 405 in rbaac filter (#335)
1 parent d1b7baa commit 558fc7f

File tree

3 files changed

+6
-47
lines changed

3 files changed

+6
-47
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
77

88
## [Unreleased]
99

10+
11+
## [0.19.21]
12+
13+
### Changed
14+
- Remove enriching (with wrong destination) responses with 405 status code in lua
15+
1016
### Changed
1117

1218
## [0.19.20]

envoy-control-core/src/main/resources/lua/ingress_rbac_logging.lua

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,6 @@ function envoy_on_response(handle)
7777
rbac_action = "denied"
7878
end
7979
log_request(lua_metadata, handle, rbac_action)
80-
if status_code == "405" then
81-
enrichResponseForWrongDestination(handle, lua_metadata)
82-
end
8380
end
8481
end
8582

@@ -110,15 +107,6 @@ function log_request(lua_metadata, handle, rbac_action)
110107
", \"rbacAction\": \""..rbac_action.."\" }")
111108
end
112109

113-
function enrichResponseForWrongDestination(handle, lua_metadata)
114-
local currentService = handle:metadata():get("service_name") or ""
115-
local lua_destination_authority = lua_metadata["request.info.lua_destination_authority"] or ""
116-
local authority = lua_metadata["request.info.authority"] or ""
117-
handle:headers():add("x-envoy-wrong-destination-reached", currentService)
118-
handle:headers():add("x-envoy-wrong-destination-target", authority)
119-
handle:headers():add("x-envoy-wrong-lua-destination-target", lua_destination_authority)
120-
end
121-
122110
escapeList = {
123111
["\\"] = "\\\\",
124112
["\""] = "\\\"",

envoy-control-tests/src/main/resources/lua_spec/ingress_rbac_logging_spec.lua

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -438,41 +438,6 @@ describe("envoy_on_response:", function()
438438
assert.spy(handle.logInfo).was_called(1)
439439
end)
440440

441-
it("as logged when status code is 405 and proper headers should be set", function ()
442-
-- given
443-
headers[':status'] = "405"
444-
445-
local filter_metadata = {
446-
['service_name'] = "service",
447-
}
448-
449-
local handle = handlerMock(headers, metadata, ssl, filter_metadata)
450-
451-
-- when
452-
envoy_on_response(handle)
453-
454-
-- then
455-
assert.spy(handle.logInfo).was_called_with(_, formatLog(
456-
"POST",
457-
"/path?query=val",
458-
"127.1.1.3",
459-
"service-first",
460-
"https",
461-
"",
462-
"405",
463-
false,
464-
false,
465-
"shadow_denied",
466-
"authority",
467-
"lua_authority"
468-
))
469-
assert.are.equal(headers["x-envoy-wrong-destination-reached"], "service")
470-
assert.are.equal(headers["x-envoy-wrong-destination-target"], "authority")
471-
assert.are.equal(headers["x-envoy-wrong-lua-destination-target"], "lua_authority")
472-
473-
assert.spy(handle.logInfo).was_called(1)
474-
end)
475-
476441
it("allowed & logged request", function ()
477442
-- given
478443
headers[':status'] = '200'

0 commit comments

Comments
 (0)