Missing upper bound on events_count causes UInt16 overflow

オープン 初心者向け
#696 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
82/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
postgresql, typescript
領域
backend, databases

調査の方向性

packages/core/src/modules/ingest/ingest.constants.ts の events_count バリデーターを読み、次に packages/core/src/modules/ingest/ingest.service.ts で replay ハンドラーがそれをどのように渡すかを確認し、packages/db/src/code-migrations/10-add-session-replay.ts の ClickHouse カラムを確認してください。65,535 と 65,536 の境界値検証テストを追加してください。65,535 が受け入れられ、それを超える値がデータベースで解析される前に拒否されれば完了です。

索引モデルが issue の本文から書いたものです。

説明

Description

While going through the session replay ingestion flow, I noticed that events_count doesn't have an upper bound in zReplayPayload, even though the corresponding ClickHouse column is of type UInt16.

Unlike chunk_index, which already has a .max(65_535) check, events_count accepts integers beyond the database's supported range. The replay handler also forwards this value unchanged.

without .max(65_535)

image

with .max(65_535')

image
Steps to reproduce

I reproduced the overflow locally using ClickHouse 26.1.3:

SELECT events_count
FROM format(
    JSONEachRow,
    'events_count UInt16',
    '{"events_count":65536}'
);

Actual result: 0

Expected behaviour: Values exceeding 65,535 should be rejected during request validation rather than silently wrapping around during database parsing.

A control query with 65535 returns the correct value.

Relevant files
  • packages/core/src/modules/ingest/ingest.constants.ts
  • packages/core/src/modules/ingest/ingest.service.ts
  • packages/db/src/code-migrations/10-add-session-replay.ts
Proposed fix

Add .max(65_535) to the events_count validator, consistent with chunk_index, along with boundary validation tests.

Are replay chunks exceeding 65,535 events intentionally supported? If not, I would be happy to submit a PR for this.

主要言語
TypeScript
スター
7.3k
フォーク
552
平均マージ
1日 10時間
マージ済み PR(30日)
13

環境構築

  • Dockerfile または Docker Compose ファイルあり
  • プルリクエストのテンプレートなし
  • コントリビューションガイドなし

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

Openpanel-dev/openpanel のほかの issue

Openpanel-dev/openpanel の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。