refactor(cas-auth): drop unnecessary raw Cookie header fallback#13635
Open
shreemaan-abhishek wants to merge 1 commit into
Open
refactor(cas-auth): drop unnecessary raw Cookie header fallback#13635shreemaan-abhishek wants to merge 1 commit into
shreemaan-abhishek wants to merge 1 commit into
Conversation
Read the per-config session cookie directly via $cookie_<name>, the same way the CAS_REQUEST_URI cookie is already read. nginx reliably exposes cookies by name regardless of length, so the manual http_cookie parsing fallback in get_cookie was dead weight.
There was a problem hiding this comment.
Pull request overview
Removes the get_cookie helper from the cas-auth plugin and reads the per-config CAS session cookie directly via ctx.var["cookie_" .. opts.cookie_name], aligning this access pattern with the existing CAS_REQUEST_URI cookie handling in the same plugin.
Changes:
- Deleted the
get_cookie(ctx, name)fallback implementation that parsed the rawCookieheader. - Updated session-cookie reads in
logout()and_M.access()to usectx.var["cookie_" .. opts.cookie_name]directly.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
AlinsRan
approved these changes
Jul 1, 2026
nic-6443
approved these changes
Jul 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The
get_cookiehelper in cas-auth was added to fall back to parsing the rawCookieheader when$cookie_<name>returned nil, on the theory that nginx's$cookie_<name>variable doesn't reliably expose cookies with long names (the per-config session cookie isCAS_SESSION_<sha256-hex>, 76 chars).That fallback isn't needed: nginx exposes cookies via
$cookie_<name>regardless of name length on supported OpenResty builds. This drops the helper and reads the session cookie directly viactx.var["cookie_" .. opts.cookie_name], consistent with how theCAS_REQUEST_URIcookie is already read in the same plugin.No behavior change on supported runtimes; pure cleanup of dead code.
Checklist