oasis-open / cti-python-stix2

OASIS TC Open Repository: Python APIs for STIX 2
https://stix2.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
364 stars 119 forks source link

Make semantic validations optional #584

Closed jozseftiborcz closed 7 months ago

jozseftiborcz commented 8 months ago

I use this library to convert CSV data to STIX formatted input. Sometimes the CSV file contains semantically invalid data (for example valid_from > valid_until). In this case the library raise a ValueError.

I think it would be better if semantic validation can be switched off (maybe with a warning message) with a global or local flag.

At least I'd like to suppress the following exception types: ValueError, InvalidValueError, AttributeError.

In the CTI platform I have to ingest STIX data, there is an option the accept non-compliant objects. So I would like to defer this decision from development time to application operation time.

What do you think?

jozseftiborcz commented 8 months ago

If you agree I could create a pull request to it.

rpiazza commented 7 months ago

The library is supposed to the model STIX library others can learn from. Suppressing those exception types would allow a large swath of invalid content.

We suggested for your purposes that you fork the repo and catch those errors yourself.

jozseftiborcz commented 7 months ago

Fair enough. Thanks, I will do it.