center-for-threat-informed-defense / tram

TRAM is an open-source platform designed to advance research into automating the mapping of cyber threat intelligence reports to MITRE ATT&CK®.
https://ctid.mitre-engenuity.org/our-work/tram/
Apache License 2.0
422 stars 90 forks source link

JSON Export is not working #175

Closed mehaase closed 2 years ago

mehaase commented 2 years ago

It is exporting a JSON object, but it is embedded inside of an HTML document. It is supposed to be a stand-alone JSON document.

mehaase commented 2 years ago

Attaching a screenshot… (this is using the AA20-302A.pdf sample report in TRAM's own test data)

screenshot of bug
nanda-rani commented 2 years ago

Hi @mehaase , Have you resolved json reading issue? I'm also facing the same. Please let me know if there is anyway to read the exported JSON file.

mehaase commented 2 years ago

Investigating this issue today. From the command line I can download the json file just fine, e.g.,

http -v "localhost:8000/api/report-export/9/?type=json" "Cookie: sessionid=(REDACTED)"  > report.json

It seems this issue is triggered only in the browser, because the browser sends the header Accept: text/html whereas the command line (HTTPie) sends Accept: application/json. I think DRF's Content Negotiation is getting in the way.

mehaase commented 2 years ago

This is fixed in #180 and released in v1.2.0.