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

Data-component channels crashes and log-sources returns an empty body when optional log sources are absent

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

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

評価

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

調査の方向性

app/controllers/data-components-controller.js の channels と log-sources のハンドラーから始め、これらのプロジェクションに対する既存の REST テストを探してください。フィールドが存在しない場合、それ以降のリビジョンでフィールドが省略される場合、フィールドに値が設定されている場合、およびコンポーネントが存在しない場合のテストを追加してください。両方のプロジェクションがフィールドの欠落時に JSON [] を返し、値が設定された応答と、コンポーネントが存在しない場合の HTTP 404 を維持すれば完了です。

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

説明

Verified on REST API 4.24.0, commit 69b37fe769e6abe7675d413451a8361aecc36bea.

Reproduction and impact

Create a valid data component with populated x_mitre_log_sources, then create a newer revision omitting that optional field. The write succeeds with HTTP 201 and ordinary component GET selects the new revision.

GET /api/data-components/COMPONENT_ID/channels
GET /api/data-components/COMPONENT_ID/log-sources
  • Channels returns HTTP 500 with body Server error..
  • Log-sources returns HTTP 200 with zero body bytes and no JSON content type.

Both populated projections work. Correlated REST logs confirm the channels exception twice:

TypeError: Cannot read properties of undefined (reading 'map')

Root cause and expected fix

The channels controller calls .map() on the missing value; the log-sources controller sends it directly.

Return HTTP 200 JSON [] from both projections when the field is absent, preserving populated responses and missing-component HTTP 404.

Omission is valid in REST, Mongoose and the version-matched ADM schema. A present STIX array requires at least one entry, so default the read projection without storing an invalid empty array.

Add REST tests for initially absent fields, later revisions omitting them, populated fields, and nonexistent components. Assert JSON array bodies explicitly.

主要言語
JavaScript
スター
57
フォーク
18
平均マージ
1日 26分
マージ済み PR(30日)
7

環境構築

はじめの一歩

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

mitre-attack/attack-workbench-rest-api のほかの issue

mitre-attack/attack-workbench-rest-api の issue をすべて見る

似ている issue

JavaScript の issue をもっと見る

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

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