Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Missing draft detection-strategy name passes dry-run but returns 500 on save

Đang mở
#504 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
68/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
javascript
Lĩnh vực
api, backend, database

Hướng nghiên cứu

Start at the POST /api/detection-strategies entry point and trace how dry-run and save requests apply ADM draft validation before reaching the Mongoose model. Reproduce the missing stix.name cases with both dry-run values and awaiting-review, then add regression coverage. Done means consistent validation and an HTTP 400 response instead of a save-time HTTP 500.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Description

A draft detection strategy without stix.name passes dry-run validation but returns HTTP 500 when saved.

Affected version: REST API 4.24.0, commit 69b37fe769e6abe7675d413451a8361aecc36bea.

Reproduction
  1. Start with a valid detection-strategy POST payload.
  2. Remove only stix.name, keeping workspace.workflow.state as work-in-progress.
  3. POST to /api/detection-strategies with the following variations:
Request Actual result
?dryRun=true 200
?dryRun=false 500
Same missing-name payload with state awaiting-review 400

REST API logs show:

Detection-Strategy validation failed: stix.name: Path stix.name is required.

Apparent cause

Draft ADM validation uses a partial schema that permits an omitted name. The Mongoose detection-strategy model requires name regardless of workflow state.

Saving fails Mongoose validation, which the repository wraps as DatabaseError and translates to HTTP 500.

Expected behavior

Draft validation, persistence, and dry-run should agree on required fields. Either support nameless drafts consistently or reject them with HTTP 400 before saving.

Suggested fix
  • Align ADM draft validation and Mongoose name requirements.
  • Return HTTP 400 for input validation failures.
  • Add regression coverage for missing-name drafts with both dry-run values and for awaiting-review validation.

Confirmed through controlled live requests and container logs. The API remained responsive; this failure did not crash the process.

Ngôn ngữ chính
JavaScript
Star
56
Fork
18
Merge trung bình
21 giờ 14 phút
Pull request đã merge (30 ngày)
10

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của mitre-attack/attack-workbench-rest-api

Tất cả issue của mitre-attack/attack-workbench-rest-api

Issue tương tự

Thêm issue về JavaScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.