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

TAXII 2.1 collection request Content-Type mismatch with client #17

Closed
chorsley opened this issue Sep 9, 2024 · 0 comments · Fixed by #19
Closed

TAXII 2.1 collection request Content-Type mismatch with client #17

chorsley opened this issue Sep 9, 2024 · 0 comments · Fixed by #19
Assignees

Comments

@chorsley
Copy link

chorsley commented Sep 9, 2024

Current behaviour: fetching collections returns a Content-Type header of application/stix+json.
Expected behaviour: fetching collections should return a Content-Type header of application/taxii+json.

Assume a simple TAXII 2.1 client connecting to attack-taxii.mitre.org using https://github.com/oasis-open/cti-taxii-client and this code:

from taxii2client.v21 import Server
server = Server('https://attack-taxii.mitre.org/api/v21/')

api_root = server.api_roots[0]
print(api_root.collections)

This code returns the following 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'

This seems to have passed testing because looking at the test code at https://github.com/mitre-attack/attack-workbench-taxii-server/blob/d5334fa6d3de3befeb6ac6329a8d57bf19c4653c/bruno/Get%20A%20Collection.bru, it sends application/taxii+json in the TAXII HTTP request as an accepted response content-type:

headers {
  Accept: application/taxii+json;version=2.1
}

But later checks for application/stix+json in the response instead:

  test("Verify response content type", function() {
    const contentType = res.getHeader('content-type');
    expect(contentType).to.include('application/stix+json');
    expect(contentType).to.include('version=2.1');
  });

The TAXII 2.1 spec also shows it returning application/taxii+json for such requests at https://docs.oasis-open.org/cti/taxii-2.1-interop/v1.0/csd01/taxii-2.1-interop-v1.0-csd01.html#_j0vnatwbha29.

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

Successfully merging a pull request may close this issue.

2 participants