Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Add cleanup for rotated OAuth token records

Đang mở
#2,340 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
35/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
csharp
Lĩnh vực
authentication, databases

Hướng nghiên cứu

Start by tracing the OAuth authorization-code exchange, refresh, grant revocation, and grants UI paths mentioned in the issue; identify where token documents are created, disabled, queried, and deleted. Then review the existing tests around those flows before deciding how cleanup preserves replay detection and grant-family behavior. Done means expired disabled records are cleaned up safely, frequent refreshes do not accumulate unbounded records, and focused rotation/cleanup tests pass.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Problem

OAuth refresh token rotation currently creates a new OAuthToken document on every successful refresh. The previous token is disabled, but it remains in the oauth-tokens index. I did not find a cleanup path for expired or disabled OAuth token documents except deleting all tokens for a user.

This means active OAuth grants can grow the oauth-tokens index indefinitely over time. It also makes grant-family operations more fragile because revocation currently pages grant-family tokens with a fixed limit.

Current behavior

  • Authorization code exchange creates an OAuthToken document.
  • Refresh finds the token by RefreshTokenHash.
  • The spent token is disabled.
  • A new OAuthToken document is created with the same GrantId.
  • Disabled/spent token documents are retained indefinitely unless the user is deleted or all user tokens are removed.

Desired outcome

Add cleanup or compaction so rotated OAuth token records do not grow forever.

A reasonable policy would be:

  • Keep the active token for each grant.
  • Remove disabled/spent OAuth token records once they are no longer needed.
  • If spent refresh-token hashes are retained for replay detection, only keep them until the relevant refresh-token expiry plus a small safety window.
  • Ensure grant revocation and the user's OAuth grants UI continue to work correctly even after old rotated rows are cleaned up.

Notes

Once a token has been refreshed, the old access token is no longer useful. The only possible reason to retain the old row is refresh-token replay detection because the old row may still contain the spent refresh-token hash. If we want that protection, retention should be bounded by RefreshExpiresUtc, not indefinite.

Acceptance criteria

  • Expired disabled OAuth token documents are cleaned up or compacted automatically.
  • Cleanup is safe for refresh-token replay detection, or the product explicitly accepts not retaining spent refresh-token hashes.
  • A grant that refreshes frequently does not accumulate unbounded token documents.
  • Grant-family revocation remains reliable even for long-lived/high-refresh grants.
  • Add focused tests for refresh rotation plus cleanup behavior.
Ngôn ngữ chính
C#
Star
2.5k
Fork
508
Merge trung bình
2 ngày 17 giờ
Pull request đã merge (30 ngày)
40

Chuẩn bị môi trường

Mở trong Codespaces

Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của exceptionless/Exceptionless

Tất cả issue của exceptionless/Exceptionless

Issue tương tự

Thêm issue về C#

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.