getsentry / getsentry/sentry-java

Session seq is raw epoch millis; duration is masked with Math.abs

Ouverte
#5,580 1 commentaire 0 réactions 0 personnes assignées Voir sur GitHub
Platform: Java
Langage dominant
Kotlin
Étoiles
1.4k
Forks
478
Merge moyen
2 j 23 h
PR mergées (30 j)
67

Description

Audit finding **C2 — theoretical, LOW-MEDIUM**.

`Session` uses raw epoch millis for `seq` and `Math.abs` for duration (`sentry/src/main/java/io/sentry/Session.java`):

* `seq` is set from `getSequenceTimestamp()`, which returns `timestamp.getTime()` (raw epoch millis) — `Session.java:309`, invoked from the session-update path at `:227`. A backward clock step between updates → the newer update has a smaller `seq` → the server can discard the latest session state (lost end/error counts).
* `calculateDurationTime` uses `Math.abs``(timestamp.getTime() - started.getTime())` (`Session.java:240`), which masks negative durations rather than surfacing them.

Source: [JAVA-557]() §C2.

Guide de contribution

Ouvrir le guide de contribution

Piste de recherche

Read sentry/src/main/java/io/sentry/Session.java, especially the session-update path around line 227, calculateDurationTime around line 240, and getSequenceTimestamp around line 309. Trace how clock changes affect sequence ordering and duration handling, then identify the relevant existing tests or test entry points. Done means the reported clock-step cases are handled without losing newer session state or masking negative durations.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
java
Domaine
observability
Type d'issue
Bug
Difficulté
4/5
Temps estimé
3-5 jours
Activité
Calme
Clarté
Plutôt claire
Accessibilité débutants
48/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.