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

Parsing Failure Mechanisms #34

Open
bauman opened this issue Oct 25, 2013 · 2 comments
Open

Parsing Failure Mechanisms #34

bauman opened this issue Oct 25, 2013 · 2 comments

Comments

@bauman
Copy link

bauman commented Oct 25, 2013

Many separate entities appear to be implementing slightly different versions of the STIX specification. The data exported from the python-stix library importing to a python dictionary can be incomplete if the incoming XML is not 100% compliant with the python-stix implementation. Can the to_dict method be updated to either failover to the a more global tool (such as xmltodict) or at least have a mode where it throws an exception if the input XML appears to have additional information that the python-stix module cannot process?

@gtback
Copy link
Contributor

gtback commented Oct 28, 2013

If there are particular schema elements that are missing (and in common enough use), we should definitely add them.

I'm not sure the best way to handle the more generic failover case. All of the information from the XML should be available in the bindings objects, but these don't get translated into the "API" objects or dictionaries. If you know there's there, you can access them, but that's far from ideal. On the other hand, tools like xmltodict don't care at all about the schema or the expected content of the XML.

@bauman
Copy link
Author

bauman commented Oct 28, 2013

I am mainly concerned with small, but custom implementation specific wrappers that cause the parsing to fail. It is easy for me to "unwrap" these small customizations before passing to the python-stix library, but I'd rather not build unwrappers for everyone who needs to build one.

Perhaps the library could check the XML schemas, and if any schema is not at mitre.org, then the library could use its own parser, but then run once more with the global parser and check the diffs on the dictionary and maybe report on the difference.

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

2 participants