Collection-index refresh returns HTTP 500 because the service method is missing

Aperta
#506 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
68/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
javascript
Ambito
api, backend, databases

Direzione di ricerca

Start with app/controllers/collection-indexes-controller.js around line 120, then read app/services/stix/collection-indexes-service.js and its base classes to trace the missing refresh entry point. Add regression coverage for newer and unchanged remote content, unknown IDs, missing URLs, and remote failures; done means POST /api/collection-indexes/{id}/refresh no longer returns this TypeError and updates the database only when appropriate.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Summary

POST /api/collection-indexes/{id}/refresh calls collectionIndexService.refresh(id), but neither CollectionIndexesService nor its base classes implement refresh. The endpoint returns HTTP 500 before looking up the index or fetching its remote URL.

Observed on REST API 4.24.0, commit 69b37fe769e6abe7675d413451a8361aecc36bea.

Reproduction
  1. Authenticate with an editor or administrator session.
  2. Create a collection index.
  3. Send POST /api/collection-indexes/{id}/refresh.

Server logs:

[ERROR] Failed with error: TypeError: collectionIndexService.refresh is not a function
[HTTP] POST /api/collection-indexes/bc94bee0-f775-47cb-b93a-cb6171ba58a5/refresh 500

The controller catches the exception; the API continued serving requests afterward.

Expected behavior

Retrieve the index from workspace.remote_url and update the database when the remote index is newer. Handle unknown IDs, missing URLs, and remote failures explicitly.

Relevant implementation

Implement single-index refresh and add regression coverage for newer/unchanged remote content and error cases.

Lingua principale
JavaScript
Stelle
56
Fork
18
Merge medio
19h 39m
PR unite (30g)
7

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di mitre-attack/attack-workbench-rest-api

Tutte le issue di mitre-attack/attack-workbench-rest-api

Issue simili

Altre issue su JavaScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.