Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error with get_objects and Unexpected Content-Type Response in TAXII 2.1 when Connecting to MITRE Server #121

Open
joseluismezquitaacc opened this issue Sep 11, 2024 · 0 comments

Comments

@joseluismezquitaacc
Copy link

Hello TAXII2-client maintainers,

I'm encountering an issue while trying to fetch objects from the MITRE ATT&CK TAXII server using the TAXII 2.1 client library. Below is a brief description of the code I'm using and the error that occurs.

Code:

from taxii2client.v21 import Collection

coleccion_datos = Collection("https://attack-taxi.mitre.org/api/v21/collections")
coleccion_objetos = coleccion_datos.get_objects("x-mitre-collection--1f5f1533-f617-4ca8-9ab4-6a02367fa019")

Error:

taxii2client.exceptions.TAXIIServiceException: Unexpected Response. Got Content-Type: 'application/stix+json; charset=utf-8; version=2.1' for Accept: 'application/taxii+json;version=2.1'
If you are trying to contact a TAXII 2.0 Server use 'from taxii2client.v20 import X'
If you are trying to contact a TAXII 2.1 Server use 'from taxii2client.v21 import X'.

I'm following the documentation for TAXII 2.1 and the MITRE ATT&CK server. However, the library expects a Content-Type: application/taxii+json, but the server responds with application/stix+json. When inspecting the response, I confirmed that it's STIX content coming from the server, which seems logical because MITRE provides STIX data.

To try to resolve the issue, I manually changed the accept header in the request like this:

coleccion_objetos = coleccion_datos.get_objects(accept="application/stix+json;version=2.1")

However, It still doesn't work.

How can I properly resolve this issue? Is there an alternative approach to handle this Content-Type mismatch without manual workarounds?

Thank you for your assistance!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant