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

Unable to creat 'Bundle' when using custom fields with SDO #73

Closed
FearonChris opened this issue Oct 9, 2017 · 1 comment
Closed

Unable to creat 'Bundle' when using custom fields with SDO #73

FearonChris opened this issue Oct 9, 2017 · 1 comment
Assignees
Labels
Milestone

Comments

@FearonChris
Copy link

Hi,

When attempting to generate a bundle, a failure message is created when passing an SDO with custom objects even with allow_custom=True set on the SDO object.

example:

v = factory.create( Vulnerability, name="Test Vulnerability", custom_field = "This is custom", allow_custom=True )

print Bundle(v)

Will result in the following output:

File "stix.py", line 142, in <module> print Bundle(v) File "/usr/local/lib/python2.7/dist-packages/stix2/core.py", line 51, in __init__ super(Bundle, self).__init__(**kwargs) File "/usr/local/lib/python2.7/dist-packages/stix2/base.py", line 121, in __init__ self._check_property(prop_name, prop_metadata, setting_kwargs) File "/usr/local/lib/python2.7/dist-packages/stix2/base.py", line 55, in _check_property kwargs[prop_name] = prop.clean(kwargs[prop_name]) File "/usr/local/lib/python2.7/dist-packages/stix2/properties.py", line 115, in clean valid = self.contained.clean(item) File "/usr/local/lib/python2.7/dist-packages/stix2/core.py", line 28, in clean parsed_obj = parse(dictified) File "/usr/local/lib/python2.7/dist-packages/stix2/core.py", line 94, in parse return obj_class(allow_custom=allow_custom, **obj) File "/usr/local/lib/python2.7/dist-packages/stix2/base.py", line 104, in __init__ raise ExtraPropertiesError(cls, extra_kwargs) stix2.exceptions.ExtraPropertiesError: Unexpected properties for Vulnerability: (custom_field).

@FearonChris
Copy link
Author

Fix works a treat. Thank you.

@gtback gtback added the bug label Jun 18, 2018
@gtback gtback added this to the 0.4 milestone Jun 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants