oasis-open / cti-taxii-client

OASIS TC Open Repository: TAXII 2 Client Library Written in Python
https://taxii2client.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
107 stars 51 forks source link

_parse_taxii_filters function issue for v2.1 #100

Closed smart-hunter closed 3 years ago

smart-hunter commented 3 years ago

Hi, oasis-open team. Thank you for your effort. I am using your repository to build a web service. Btw I got an issue with TAXIICollectionSource._parse_taxii_filters

I use taxii2.1 TAXII_FILTERS = ['added_after', 'id', 'type', 'version'] I need to use 'next' and 'limit' parameters. but I couldn't change TAXII_FILTERS. So that I had to re-define TAXIICollectionSource._parse_taxii_filters.

    def _parse_taxii_filters(self, query):
        """Parse out TAXII filters that the TAXII server can filter on

        Does not put in TAXII spec format as the TAXII2Client (that we use)
        does this for us.

        Note:
            Currently, the TAXII2Client can handle TAXII filters where the
            filter value is list, as both a comma-seperated string or python
            list.

            For instance - "?match[type]=indicator,sighting" can be in a
            filter in any of these formats:

            Filter("type", "<any op>", "indicator,sighting")
            Filter("type", "<any op>", ["indicator", "sighting"])

        Args:
            query (list): list of filters to extract which ones are TAXII
                specific.

        Returns:
            A list of TAXII filters that meet the TAXII filtering parameters.

        """
        taxii_filters = []

        for filter_ in query:
            if filter_.property in ['added_after', 'id', 'type', 'version', 'limit', 'next']:
                taxii_filters.append(filter_)

        return taxii_filters
smart-hunter commented 3 years ago

can you update the issue?

clenk commented 3 years ago

Hi; this actually looks like an issue for https://github.com/oasis-open/cti-python-stix2, which is where TAXIICollectionSource comes from.

I opened an issue there to track this: https://github.com/oasis-open/cti-python-stix2/issues/510.

smart-hunter commented 3 years ago

oh, sorry. thank you.