TraceState does not check illegal inputs

オープン
#5,136 コメント 3 件 リアクション 0 件 担当者 0 名 GitHub で見る

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

@Abhinav0905 がすでに取り組んでいます。

2026年8月9日 から。

  • #5173 @64johnlee による — マージされずにクローズ
  • #5599 @sidsri14 による — マージされずにクローズ

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
65/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
python

調査の方向性

TraceState.add から始め、提示されたケースを再現し、受け入れられる有効な tenant ID と、拒否されるべき入力を比較します。既存のバリデーションとそのテストを追跡し、提示された不正な形式と長さが拒否される一方で、有効なケースは引き続き受け入れられることを確認してから、関連する TraceState テストスイートを実行します。

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

説明

bug
Describe your environment

OS: Windows
Python version: Python 3.13
SDK version: the latest
API version: the latest

TraceState.add() does not fully check whether the inputs are correct.

What happened?

TraceState.add() should reject the illegal inputs.

Steps to Reproduce

Here is my test case:

`from opentelemetry.trace import TraceState

Java constants mapped to Python

EMPTY = TraceState()
FIRST_VALUE = "first_value" # Adjust to match your test's actual constant
class MyTestCase(unittest.TestCase):

def test_valid_long_tenant_id(self):
    result = EMPTY.add("12345678901234567890@nr", FIRST_VALUE)
    assert result.get("12345678901234567890@nr") == FIRST_VALUE


def test_vendor_id_longer_than_13_characters(self):
    with self.assertRaises(Exception) as context:
        EMPTY.add("1@nrabcdefghijkl", FIRST_VALUE)
    self.assertTrue('This is broken' in context.exception)

def test_vendor_id_longer_than_13_characters_long_tenant_id(self):
    with self.assertRaises(Exception) as context:
        EMPTY.add("12345678901234567890@nrabcdefghijkl", FIRST_VALUE)
    self.assertTrue('This is broken' in context.exception)

def test_tenant_id_longer_than_240_characters(self):
    tenant_id = "a" * 241
    with self.assertRaises(Exception) as context:
        EMPTY.add(f"{tenant_id}@nr", FIRST_VALUE)
    self.assertTrue('This is broken' in context.exception)

def test_non_vendor_format_first_key_character(self):
    with self.assertRaises(Exception) as context:
        EMPTY.add("1acdfrgs", FIRST_VALUE)
    self.assertTrue('This is broken' in context.exception)`
Expected Result

Shall reject.

Actual Result

Added.

Additional context

No response

Would you like to implement a fix?

None

Tip

React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it. Learn more here.

主要言語
Python
スター
2.7k
フォーク
1.1k
平均マージ
3日 12時間
マージ済み PR(30日)
16

環境構築

はじめの一歩

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

open-telemetry/opentelemetry-python のほかの issue

open-telemetry/opentelemetry-python の issue をすべて見る

似ている issue

Python の issue をもっと見る

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

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