fix(oidc): fix Set-Cookie header corruption during session refresh (#3928)

Signed-off-by: jingze <daijingze.djz@alibaba-inc.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Jingze
2026-06-05 17:58:20 +08:00
committed by GitHub
parent 137d76332e
commit 57db9ccc46
3 changed files with 8 additions and 4 deletions

View File

@@ -5,7 +5,7 @@ go 1.24.1
toolchain go1.24.4
require (
github.com/higress-group/oauth2-proxy v1.0.1-0.20260604015908-ddc2e341fc40
github.com/higress-group/oauth2-proxy v1.0.1-0.20260605094027-396b01ca2ca4
github.com/higress-group/proxy-wasm-go-sdk v0.0.0-20250611100342-5654e89a7a80
github.com/higress-group/wasm-go v1.0.2-0.20250911113549-cbf1cfcce774
github.com/tidwall/gjson v1.18.0

View File

@@ -14,8 +14,8 @@ github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY=
github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ=
github.com/higress-group/oauth2-proxy v1.0.1-0.20260604015908-ddc2e341fc40 h1:898/7rZo1g5ziKhUkqTUm9iALOrjUFe5p66bT3SKDOg=
github.com/higress-group/oauth2-proxy v1.0.1-0.20260604015908-ddc2e341fc40/go.mod h1:sDlsoo4dx+Cx56vI5kegeXZAoQ4nnd7xWL7Oc4/4hLI=
github.com/higress-group/oauth2-proxy v1.0.1-0.20260605094027-396b01ca2ca4 h1:P7p5oh95mvgi38QhIN+nHJJCJPGjWqv3UHAmKzo25ko=
github.com/higress-group/oauth2-proxy v1.0.1-0.20260605094027-396b01ca2ca4/go.mod h1:sDlsoo4dx+Cx56vI5kegeXZAoQ4nnd7xWL7Oc4/4hLI=
github.com/higress-group/proxy-wasm-go-sdk v0.0.0-20250611100342-5654e89a7a80 h1:xqmtTZI0JQ2O+Lg9/CE6c+Tw9KD6FnvWw8EpLVuuvfg=
github.com/higress-group/proxy-wasm-go-sdk v0.0.0-20250611100342-5654e89a7a80/go.mod h1:tRI2LfMudSkKHhyv1uex3BWzcice2s/l8Ah8axporfA=
github.com/higress-group/wasm-go v1.0.2-0.20250911113549-cbf1cfcce774 h1:3nzDlUZ8+Nc0c2f8y0wUiw6mnyu1+ZYT0mK7x9Oitro=

View File

@@ -84,7 +84,11 @@ func onHttpRequestHeaders(ctx wrapper.HttpContext, config PluginConfig, log log.
func onHttpResponseHeaders(ctx wrapper.HttpContext, config PluginConfig, log log.Log) types.Action {
value := ctx.GetContext(oidc.SetCookieHeader)
if value != nil {
proxywasm.AddHttpResponseHeader(oidc.SetCookieHeader, value.(string))
if cookies, ok := value.([]string); ok {
for _, c := range cookies {
proxywasm.AddHttpResponseHeader(oidc.SetCookieHeader, c)
}
}
}
config.oidcHandler.SetContext(nil)
return types.ActionContinue