XML output writes a vulnerability's `created` date as `published` and `updated`
メンテナーはふだん 7 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 88/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- node.js, typescript, xml
調査の方向性
src/serialize/xml/normalize.ts の VulnerabilityNormalizer から始めて、日付要素の構築を確認してください。XML 出力をモデルの日付および既存の JSON 出力と比較してください。XML ノーマライザーを更新し、異なる日付と欠落した日付を対象とするカバレッジを追加または調整してください。XML では各日付がそれぞれ独立して保持され、関連するスナップショットが一致するようにしてください。
索引モデルが issue の本文から書いたものです。
説明
Describe the bug
The XML normalizer writes a vulnerability's created date into all three date elements. published and updated are never read, so in XML they are wrong, missing, or made up. The JSON output is correct.
To reproduce
const { Models, Serialize, Spec } = require('@cyclonedx/cyclonedx-library')
const bom = new Models.Bom()
bom.vulnerabilities.add(new Models.Vulnerability.Vulnerability({
bomRef: 'v1',
created: new Date('2021-01-01T00:00:00Z'),
published: new Date('2022-02-02T00:00:00Z'),
updated: new Date('2023-03-03T00:00:00Z')
}))
const serializer = new Serialize.XmlSerializer(
new Serialize.XML.Normalize.Factory(Spec.Spec1dot6))
console.log(serializer.serialize(bom, { space: 2 }))
Output:
<created>2021-01-01T00:00:00.000Z</created>
<published>2021-01-01T00:00:00.000Z</published>
<updated>2021-01-01T00:00:00.000Z</updated>
Two more cases:
| Dates set on the model | XML output |
|---|---|
only published and updated |
no date elements at all |
only created |
created, plus published and updated with the same value |
Expected behaviour
Each element carries its own value, as in the JSON output:
<created>2021-01-01T00:00:00.000Z</created>
<published>2022-02-02T00:00:00.000Z</published>
<updated>2023-03-03T00:00:00.000Z</updated>
Cause
src/serialize/xml/normalize.ts, in VulnerabilityNormalizer:
makeOptionalDateTimeElement(data.created, 'created'),
makeOptionalDateTimeElement(data.created, 'published'),
makeOptionalDateTimeElement(data.created, 'updated'),
The stored snapshots show it too: tests/_data/models.js sets published to ...00:00:41 and updated to ...00:00:42, and tests/_data/serializeResults/xml_complex_spec1.6.xml.bin has ...00:00:40 three times.
Environment
- Library version: 10.5.0 (
mainat 7456cad) - Node.js 24.18.0, Windows 11
I can open a PR with the fix and the regenerated snapshots.
AI disclosure: this was found with the help of Claude Code. The snippet was run against the built library.
- 主要言語
- TypeScript
- スター
- 25
- フォーク
- 16
- 平均マージ
- 5日 17時間
- マージ済み PR(30日)
- 9
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
CycloneDX/cyclonedx-javascript-library のほかの issue
-
export for denoオープンenhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
CycloneDX/cyclonedx-javascript-library#1514 ·
メンテナーはふだん 7 日以内に返信
-
CycloneDX 1.7.1オープン
難易度 3/5 1〜2日 初心者へのやさしさ 48/100
CycloneDX/cyclonedx-javascript-library#1463 ·
メンテナーはふだん 7 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 68/100
CycloneDX/cyclonedx-javascript-library#1446 ·
メンテナーはふだん 7 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
CycloneDX/cyclonedx-javascript-library#1441 ·
メンテナーはふだん 7 日以内に返信
-
enhancement schema 2.0
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
CycloneDX/cyclonedx-javascript-library#1436 ·
メンテナーはふだん 7 日以内に返信
CycloneDX/cyclonedx-javascript-library の issue をすべて見る
似ている issue
-
area:tooling good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
interledger/publisher-tools#1007 ·
メンテナーはふだん 1 日以内に返信
-
priority/medium roadmap/v1.1.1 stakeholder/rapr type/bug
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
databrickslabs/ontos#1420 ·
メンテナーはふだん 3 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
vercel-labs/just-bash#756 ·
メンテナーはふだん 1 日以内に返信
-
area: ci good first issue
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
interledger/web-monetization-extension#1555 ·
メンテナーはふだん 1 日以内に返信
-
🐞 bug 🧐 unconfirmed
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
Tencent/tdesign-vue-next#7056 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信