Skip to content

Propagate Lua-Resty-Session Revocation Store Failures - #571

Merged
kevinlzw merged 6 commits into
zmartzone:masterfrom
Hockenba:fix/propagate-session-destroy-errors-on-logout
Sep 5, 2026
Merged

kevinlzw merged 6 commits into
zmartzone:masterfrom
Hockenba:fix/propagate-session-destroy-errors-on-logout

Conversation

@Hockenba

@Hockenba Hockenba commented Sep 2, 2026 •

Copy link
Copy Markdown
Contributor

Summary

When lua-resty-session 4.2 is configured with cookie storage and a revocation
backend, session:destroy() can fail if the store is unreachable while
revocation_fail_mode is closed. Previously, openidc_logout ignored that
error and continued the logout redirect, so the user appeared logged out while
the session cookie remained valid after the store recovered.

This change propagates revocation-store failures from logout and session start
when fail mode is closed, so callers can handle the error instead of treating
logout as successful.

  • add openidc_destroy_session and return destroy errors from openidc_logout
    and authenticate
  • add openidc_start_session to surface closed-mode revocation errors from
    session.start in authenticate and access_token
  • bump lua-resty-session to 4.2.0
  • add integration tests for revocation_fail_mode open and closed during
    logout

See Lua-Resty-Session (completed by me) and APISIX (paused until this is merged).

Checklist

  • Tests pass with docker build -f tests/Dockerfile . -t lua-resty-openidc/test
  • Tests pass with docker run -t --rm lua-resty-openidc/test:latest
  • ChangeLog is updated for behavior changes, bug fixes, features, or user-visible documentation changes

@Hockenba
Hockenba force-pushed the fix/propagate-session-destroy-errors-on-logout branch from 51d86e8 to ecf3d02 Compare September 2, 2026 17:39
When session:destroy() fails (for example because the revocation store
is unreachable in closed fail mode), return the error from
openidc_logout and authenticate instead of continuing with the logout
redirect.
@Hockenba
Hockenba force-pushed the fix/propagate-session-destroy-errors-on-logout branch from ecf3d02 to d128dc9 Compare September 2, 2026 17:41

@kevinlzw kevinlzw left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for addressing the fail-closed logout behavior. Before merging, please add coverage for the other newly introduced fail-closed path: a closed-mode revocation read failure during session.start().

The current test only makes revocation.set fail after session startup, so it does not exercise the new unable to check session revocation branch in openidc_start_session, nor the openidc.access_token() caller. Please add tests that make revocation.get fail and verify that both APIs return the error without authenticating the request.

Also, this logic relies on exact lua-resty-session error strings while the rockspec accepts any version >= 4.2.0. Please either use a stable upstream error signal or constrain and test the supported dependency range, so a later dependency release cannot silently weaken closed-mode behavior.

@Hockenba
Hockenba force-pushed the fix/propagate-session-destroy-errors-on-logout branch 2 times, most recently from 3d5f703 to bf70243 Compare September 3, 2026 16:06
@Hockenba
Hockenba force-pushed the fix/propagate-session-destroy-errors-on-logout branch from bf70243 to 02bbadc Compare September 3, 2026 16:07
@Hockenba
Hockenba requested a review from kevinlzw September 3, 2026 16:10
@Hockenba

Hockenba commented Sep 3, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for addressing the fail-closed logout behavior. Before merging, please add coverage for the other newly introduced fail-closed path: a closed-mode revocation read failure during session.start().

The current test only makes revocation.set fail after session startup, so it does not exercise the new unable to check session revocation branch in openidc_start_session, nor the openidc.access_token() caller. Please add tests that make revocation.get fail and verify that both APIs return the error without authenticating the request.

Also, this logic relies on exact lua-resty-session error strings while the rockspec accepts any version >= 4.2.0. Please either use a stable upstream error signal or constrain and test the supported dependency range, so a later dependency release cannot silently weaken closed-mode behavior.

Addressed.

@kevinlzw
kevinlzw merged commit bc773b8 into zmartzone:master Sep 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants