Skip to content

docs(oauth): document StatelessOAuthStateStore anti-replay caveat#1920

Merged
WilliamBergamin merged 1 commit into
mainfrom
add-statless-store-doc-string
Jul 21, 2026
Merged

docs(oauth): document StatelessOAuthStateStore anti-replay caveat#1920
WilliamBergamin merged 1 commit into
mainfrom
add-statless-store-doc-string

Conversation

@WilliamBergamin

@WilliamBergamin WilliamBergamin commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds documentation to StatelessOAuthStateStore (introduced in #1916) covering the behavior raised in #1919: unlike the stateful stores (FileOAuthStateStore, the SQLAlchemy/SQLite3 stores, and AmazonS3OAuthStateStore), this store provides no one-time-use / anti-replay guarantee. A valid, unexpired token passes consume() every time.

This is inherent to a self-contained stateless token 😅 it can only be invalidated by expiry, not revoked early, without reintroducing the server-side state. So the fix is to document the contract and give integrators guidance.

Notes

  • No logic touched

Add a class docstring and consume() docstring to StatelessOAuthStateStore
explaining that, unlike the stateful stores, it provides no one-time-use /
anti-replay guarantee: a valid, unexpired token passes consume() every time.
This is inherent to a self-contained stateless token, which can only be
invalidated by expiry.

Includes integrator guidance: keep expiration_seconds short (the lifetime is
the replay window; 300s/5min recommended, matching the OAuth sample), make the
callback idempotent, and a note that CSRF protection is unaffected since it
comes from the OAuthStateUtils state cookie rather than one-time-use.

Documentation only; no behavior change. Addresses #1919.

Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
@WilliamBergamin WilliamBergamin self-assigned this Jul 21, 2026
@WilliamBergamin WilliamBergamin added the docs M-T: Documentation work only label Jul 21, 2026
@WilliamBergamin
WilliamBergamin requested a review from vegeris July 21, 2026 15:29
@WilliamBergamin
WilliamBergamin marked this pull request as ready for review July 21, 2026 15:30
@WilliamBergamin
WilliamBergamin requested a review from a team as a code owner July 21, 2026 15:30
@codecov

codecov Bot commented Jul 21, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 84.17%. Comparing base (cff3dc1) to head (c939411).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1920   +/-   ##
=======================================
  Coverage   84.17%   84.17%           
=======================================
  Files         118      118           
  Lines       13423    13423           
=======================================
  Hits        11299    11299           
  Misses       2124     2124           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

@vegeris vegeris left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM!

@WilliamBergamin
WilliamBergamin merged commit f41fd83 into main Jul 21, 2026
44 of 46 checks passed
@WilliamBergamin
WilliamBergamin deleted the add-statless-store-doc-string branch July 21, 2026 19:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs M-T: Documentation work only

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants