Skip to content
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
8 changes: 4 additions & 4 deletions apisix-master-0.rockspec
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ dependencies = {
"api7-lua-resty-jwt = 0.2.6-0",
"lua-resty-hmac-ffi = 0.06-1",
"lua-resty-cookie = 0.4.1-1",
"lua-resty-session = 3.10",
"lua-resty-session = 4.1.5-1",
"opentracing-openresty = 0.1-0",
"lua-resty-radixtree = 2.9.2-0",
"lua-protobuf = 0.5.3-1",
"lua-resty-openidc = 1.7.6-3",
"lua-resty-openidc = 1.8.0-1",
"luafilesystem = 1.8.0-1",
"nginx-lua-prometheus-api7 = 0.20240201-1",
"jsonschema = 0.9.9-0",
Expand All @@ -72,9 +72,9 @@ dependencies = {
"ext-plugin-proto = 0.6.1-0",
"casbin = 1.45.0-1",
"inspect == 3.1.3-0",
"lua-resty-rocketmq = 0.3.0-0",
"lua-resty-rocketmq = 0.4.2-0",
"opentelemetry-lua = 0.2-6",
"net-url = 0.9-1",
"net-url = 1.2-1",
"xml2lua = 1.6-2",
"nanoid = 0.1-1",
"lua-resty-mediador = 0.1.2-1",
Expand Down
18 changes: 9 additions & 9 deletions apisix/plugins/authz-casdoor.lua
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ end

function _M.access(conf, ctx)
local current_uri = ctx.var.uri
local session_obj_read, session_present = session.open()
local session_obj, sess_err, session_present = session.open()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the response format has changed in the new version

-- step 1: check whether hits the callback
local m, err = ngx.re.match(conf.callback_url, ".+//[^/]+(/.*)", "jo")
if err or not m then
Expand All @@ -103,11 +103,11 @@ function _M.access(conf, ctx)
local real_callback_url = m[1]
if current_uri == real_callback_url then
if not session_present then
err = "no session found"
err = "no session found: " .. sess_err
core.log.error(err)
return 503
end
local state_in_session = session_obj_read.data.state
local state_in_session = session_obj:get("state")
if not state_in_session then
err = "no state found in session"
core.log.error(err)
Expand Down Expand Up @@ -135,7 +135,7 @@ function _M.access(conf, ctx)
core.log.error(err)
return 503
end
local original_url = session_obj_read.data.original_uri
local original_url = session_obj:get("original_uri")
if not original_url then
err = "no original_url found in session"
core.log.error(err)
Expand All @@ -144,20 +144,20 @@ function _M.access(conf, ctx)
local session_obj_write = session.new {
cookie = {lifetime = lifetime}
}
session_obj_write:start()
session_obj_write.data.access_token = access_token
session_obj_write:open()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:start has been removed in the new version

session_obj_write:set("access_token", access_token)
session_obj_write:save()
core.response.set_header("Location", original_url)
return 302
end

-- step 2: check whether session exists
if not (session_present and session_obj_read.data.access_token) then
if not (session_present and session_obj:get("access_token")) then
-- session not exists, redirect to login page
local state = rand(0x7fffffff)
local session_obj_write = session.start()
session_obj_write.data.original_uri = current_uri
session_obj_write.data.state = state
session_obj_write:set("original_uri", current_uri)
session_obj_write:set("state", state)
session_obj_write:save()

local redirect_url = conf.endpoint_addr .. "/login/oauth/authorize?" .. ngx.encode_args({
Expand Down
7 changes: 4 additions & 3 deletions apisix/plugins/openid-connect.lua
Original file line number Diff line number Diff line change
Expand Up @@ -681,7 +681,7 @@ function _M.rewrite(plugin_conf, ctx)
end

-- Authenticate the request. This will validate the access token if it
-- is stored in a session cookie, and also renew the token if required.
-- is stored in a sessions cookie, and also renew the token if required.
-- If no token can be extracted, the response will redirect to the ID
-- provider's authorization endpoint to initiate the Relying Party flow.
-- This code path also handles when the ID provider then redirects to
Expand Down Expand Up @@ -731,8 +731,9 @@ function _M.rewrite(plugin_conf, ctx)
end

-- Add X-Refresh-Token header, maybe.
if session.data.refresh_token and conf.set_refresh_token_header then
core.request.set_header(ctx, "X-Refresh-Token", session.data.refresh_token)
local refresh_token = session:get("refresh_token")
if refresh_token and conf.set_refresh_token_header then
core.request.set_header(ctx, "X-Refresh-Token", refresh_token)
end
end
end
Expand Down
4 changes: 2 additions & 2 deletions apisix/plugins/rocketmq-logger.lua
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,8 @@ function _M.log(conf, ctx)
if err then
return nil, "failed to create the rocketmq producer: " .. err
end
core.log.info("rocketmq nameserver_list[1] port ",
prod.client.nameservers[1].port)
core.log.info("rocketmq nameserver_list[1]: ",
prod.client.nameservers[1])
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

port is no longer available in this data structure.

-- Generate a function to be executed by the batch processor
local func = function(entries, batch_max_size)
local data, err
Expand Down
4 changes: 2 additions & 2 deletions t/plugin/openid-connect5.t
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,8 @@ hello world
local httpc = http.new()
local res, err = httpc:request_uri(uri, {method = "GET"})

-- Extract cookie which is not authenticated
local cookie_str = concatenate_cookies(res.headers['Set-Cookie'])
-- set a random cookie
local cookie_str = "foobaar"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the previous session library used by lua-resty-openidc would set Set-Cookie header. This no longer happens in the new version.


-- Make the call to protected route with cookie
local function firstRequest()
Expand Down
14 changes: 6 additions & 8 deletions t/plugin/openid-connect6.t
Original file line number Diff line number Diff line change
Expand Up @@ -141,15 +141,13 @@ passed
return
end

local cookie_str = concatenate_cookies(res.headers['Set-Cookie'])
local parts = {}
for part in string.gmatch(cookie_str, "[^|]+") do
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cookies are no longer | separated, they are in fact encrypted in the new version.

table.insert(parts, part)
end
local target_number = tonumber(parts[2], 10) - 86400
-- ngx.say(target_number, current_time)
if target_number >= current_time then
local cookies = res.headers['Set-Cookie']
-- lua-resty-session v4 changed cookie format/handling.
-- We verify that a cookie is returned, indicating a session was created.
if cookies then
ngx.say("passed")
else
ngx.say("failed: no Set-Cookie header found")
end
}
}
Expand Down
4 changes: 2 additions & 2 deletions t/plugin/rocketmq-logger2.t
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ __DATA__
passed
--- wait: 5
--- error_log
phase_func(): rocketmq nameserver_list[1] port 9876
phase_func(): rocketmq nameserver_list[1] port 19876
phase_func(): rocketmq nameserver_list[1]: 127.0.0.1:9876
phase_func(): rocketmq nameserver_list[1]: 127.0.0.1:19876
--- no_error_log eval
qr/not found topic/

Expand Down
2 changes: 1 addition & 1 deletion t/plugin/serverless.t
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,7 @@ passed
--- request
GET /echo?args=%40%23%24%25%5E%26
--- response_body chomp
args=@#$%^&
args=@%23$%25%5E&
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change due to net-url upgrade

Copy link
Member

@nic-6443 nic-6443 Jan 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In other words, the three characters # / % / ^ are no longer decoded by default, which may cause compatibility issues. However, as long as the new behavior conforms to URL parser standards, it should also be upgraded.




Expand Down
Loading