moonming opened a new pull request, #14247:
URL: https://github.com/apache/apisix/pull/14247

   ### Description
   
   `feishu-auth` and `dingtalk-auth` used the session library's default 
audience and fixed cookie names. When routes for different applications shared 
a session secret on the same host, a valid session issued by one application 
was accepted by another without running that application's OAuth flow.
   
   The issued session cookies also did not set `Secure`, allowing browsers to 
send them over an unencrypted HTTP connection.
   
   This PR:
   
   - Derives a stable session `audience` from the application identity 
(`app_id`/`app_key`) and the token/userinfo Provider endpoints. Route IDs and 
session secrets are deliberately excluded so same-application cross-route 
sharing and secret rotation keep working.
   - Adds `cookie_secure` (default `true`) to both plugin schemas. Setting it 
to `false` is supported for local HTTP development.
   - Documents the session scope and the new option in the existing plugin 
references.
   - Adds regression coverage for cross-application cookie replay, the default 
`Secure` attribute, and the explicit opt-out.
   
   #### Which issue(s) this PR fixes:
   
   N/A.
   
   ### Compatibility
   
   Existing sessions use the library's previous default audience and will need 
to authenticate again once after upgrading. Accepting those sessions under the 
new audience would preserve the cross-application issue. Same-application 
cross-route session sharing and `secret_fallbacks` rotation are covered by the 
existing tests.
   
   ### Verification
   
   The new tests were first run against the unpatched code. The 
cross-application replay reached the upstream instead of restarting 
authentication, and the default cookie lacked `Secure`.
   
   After the fix, using the APISIX Runtime Linux container with a real etcd 
service:
   
   - `t/plugin/feishu-auth.t`: 58 checks passed.
   - `t/plugin/dingtalk-auth.t`: 58 checks passed.
   - `luacheck` on both modified plugin files: 0 warnings, 0 errors.
   - `git diff --check`: passed.
   
   ### Checklist
   
   - [x] I have explained the need for this PR and the problem it solves
   - [x] I have explained the changes or the new features added to this PR
   - [x] I have added tests corresponding to this change
   - [x] I have updated the documentation to reflect this change
   - [ ] I have verified that this change is backward compatible (existing 
sessions need to authenticate once after upgrading, as described above)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to