AOSSIE-Org / AOSSIE-Org/DebateAI

[Bug] Rating Reset Exploit via NaN Sanitiization

Abierto
#298 0 comentarios 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
TypeScript
Estrellas
84
Forks
198
Merge medio
2 d 19 h
PR fusionados (30 d)
30

Descripción

Description
The sanitizePlayerMetrics function defaults a player's rating back to 1200 (default) if the mathematical calculation results in NaN or Inf. A malicious user could craft inputs or exploit the time-decay bug to trigger a math error, effectively resetting a poor rating back to start.

How to Reproduce
1. Trigger a condition where Glicko-2 math divides by zero or takes the square root of a negative number (e.g., via corrupted LastUpdate times in Issue 7).
2. The rating service sees NaN.
3. The service resets the rating to 1200.

Root Cause
In rating_service.go:
```
if math.IsNaN(player.Rating) || math.IsInf(player.Rating, 0) {
player.Rating = initialRating // Reset to 1200
}
```

This fails open instead of failing closed.

Expected Behavior
If a math error occurs, the rating update should be aborted, and the error logged. The user's rating should remain at its previous value, not reset to a new user's 1200.

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.