Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

Add cleanup for rotated OAuth token records

Abierto
#2,340 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
35/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Tranquilo
Stack tecnológico
csharp

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.
Lenguaje dominante
C#
Estrellas
2.5k
Forks
508
Merge medio
2 d 17 h
PR fusionados (30 d)
40

Preparar el entorno

Abrir en Codespaces

Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de exceptionless/Exceptionless

Todos los issues de exceptionless/Exceptionless

Issues similares

Más issues de C#

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.