Data-component channels crashes and log-sources returns an empty body when optional log sources are absent
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 85/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- javascript
调研方向
从 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
- 星标
- 56
- 派生
- 18
- 平均合并
- 19 小时 39 分钟
- 30 天内合并 PR
- 7
环境准备
- 提供 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
mitre-attack/attack-workbench-rest-api 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 86/100
-
难度 2/5 1-3 小时 新手友好度 86/100
-
Add ADM validation bypass for server-controlled fields on non-compliant objects可能已有人在做 @seansica 于 22 天前认领。 未关闭
mitre-attack/attack-workbench-rest-api#517 · 已指派 1 人 ·
-
难度 3/5 1-2 天 新手友好度 74/100
mitre-attack/attack-workbench-rest-api#512 · 1 条评论 ·
-
难度 3/5 1-2 天 新手友好度 68/100
查看 mitre-attack/attack-workbench-rest-api 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复
-
help wanted Idea 💡 wdio-cli
难度 2/5 1-3 小时 新手友好度 66/100
webdriverio/webdriverio#16361 · 2 条评论 ·
维护者通常 1 天内回复
-
bug new-client
难度 1/5 1-3 小时 新手友好度 88/100
NUWCDIVNPT/stig-manager#2285 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 88/100
Fei2411/DeepSeek-Bot#922 · 1 个 reaction ·
-
Workers AI integration drops output of non-streaming chat responses in the OpenAI format (`choices`)未关闭Bug Cloudflare Workers Spans
难度 2/5 1-3 小时 新手友好度 78/100
getsentry/sentry-javascript#26120 · 1 条评论 ·
维护者通常 1 天内回复