Missing draft detection-strategy name passes dry-run but returns 500 on save
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 68/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- javascript
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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
- Start with a valid detection-strategy POST payload.
- Remove only
stix.name, keepingworkspace.workflow.stateaswork-in-progress. - POST to
/api/detection-strategieswith 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.nameis 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-reviewvalidation.
Confirmed through controlled live requests and container logs. The API remained responsive; this failure did not crash the process.
- Lingua principale
- JavaScript
- Stelle
- 57
- Fork
- 18
- Merge medio
- 1g 26m
- PR unite (30g)
- 7
Preparare l'ambiente
- Include un Dockerfile o un file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di mitre-attack/attack-workbench-rest-api
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 74/100
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 68/100
Tutte le issue di mitre-attack/attack-workbench-rest-api
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
smansfield635-create/smansfield635-create.github.io#5818 · 4 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
documentation
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
danjdewhurst/story-skills#538 ·
I maintainer di solito rispondono entro 1 giorno
-
good first issue
Difficoltà 1/5 1-3 ore Idoneità per principianti 88/100
anoopcodehack/DevBoard#589 ·
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 2/5 Meno di un'ora Idoneità per principianti 85/100
capricorn86/happy-dom#2474 ·
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 95/100
vigetlabs/mega-menu-block#30 ·
I maintainer di solito rispondono entro 2 giorni