Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

CycloneDX output: metadata.properties[].value emits JSON array instead of string

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

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

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

2026年10月11日 から。

  • #5354 @0Cymantek0 による — オープン
  • #5356 @0Cymantek0 による — オープン

評価

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

調査の方向性

まず issue にある --cyclonedx コマンドで問題を再現し、次に Python のチェックスクリプトを実行して、値が文字列でない properties を一覧表示してください。CycloneDX 出力のコードを検索し、オプションのリストから scancode:options プロパティが組み立てられている箇所を見つけてください。すべての metadata.properties[].value が文字列になり、チェックが何も出力しなくなれば完了です。ペイロードだけでは、スペースで連結するか、カンマで連結するか、JSON エンコードするかは決まらないので、編集前にその選択を確認してください。

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

説明

Describe the bug

When using --cyclonedx output, ScanCode produces metadata.properties[].value as a JSON array instead of a string. The CycloneDX specification (versions 1.4, 1.5, and 1.6) defines properties[].value as type: string.

This causes downstream tools like cyclonedx-cli merge to crash:

Unhandled exception: System.Text.Json.JsonException:
  The JSON value could not be converted to System.String.
  Path: $.metadata.properties[1].value
  ---> System.InvalidOperationException:
    Cannot get the value of a token type 'StartArray' as a string.
Example output (simplified)
{
  "metadata": {
    "properties": [
      {
        "name": "scancode:version",
        "value": "33.0.0"
      },
      {
        "name": "scancode:options",
        "value": ["--package", "--license", "--copyright", "--strip-root"]
      }
    ]
  }
}

The second property has value as an array ["--package", "--license", "--copyright", "--strip-root"] instead of a string like "--package --license --copyright --strip-root".

CycloneDX spec reference

The value field in a property object is defined as type: string in all CycloneDX spec versions:

  • v1.4: value: type: string
  • v1.5: value: type: string
  • v1.6: value: type: string

The spec says: "The value of the property." with type string. If multiple values need to be represented, the spec recommends duplicate property names with different values, not array-typed values.

Related
To reproduce
pip install scancode-toolkit
scancode --package --license --copyright --cyclonedx output.cdx.json /path/to/project

Then check for non-string property values:

import json
with open('output.cdx.json') as f:
    data = json.load(f)
for p in data.get('metadata', {}).get('properties', []):
    if not isinstance(p.get('value'), str):
        print(f'Non-string value: {p["name"]} = {p["value"]} (type: {type(p["value"]).__name__})')
Expected behavior

All properties[].value fields should be strings per the CycloneDX specification. Array values should be serialized as a string (e.g. comma-separated or JSON-encoded string).

Environment
  • scancode-toolkit: latest (installed via pip)
  • Output format: --cyclonedx (JSON)
  • Python: 3.12+
主要言語
Python
スター
2.7k
フォーク
831
平均マージ
3日 4時間
マージ済み PR(30日)
7

環境構築

はじめの一歩

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

aboutcode-org/scancode-toolkit のほかの issue

aboutcode-org/scancode-toolkit の issue をすべて見る

似ている issue

Python の issue をもっと見る

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

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