-
Notifications
You must be signed in to change notification settings - Fork 23
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
Relationship target refs are causing errors on certain IDs. #114
Comments
You state:
I'm not sure what you are trying to say. Maybe include an example id?? This function assumes ids with a certain pattern. Perhaps you need to special case your code to handle the pattern you use. |
My apologies. Our IDs follow the ctap:TTP-00000000######## pattern rather than the suggested ctap:TTP-uuid4 pattern. |
@tigerkatz, the STIX 2.0 spec says that an ID must use a uuid: Identifiers MUST follow the form object-type--UUIDv4, where object-type is the exact value (all type names are lowercase strings, by definition) from the type property of the object being identified or referenced and where the UUIDv4 is an RFC 4122-compliant Version 4 UUID. Perhaps there is some pre or post processing you can do to associate your STIX 1.x ids with the new valid STIX 2.0 ones? |
I updated the original comment to put backticks (``) around what this was supposed to say:
GitHub's Markdown renderer treats everything between angle brackets (<>) as an "HTML" tag and doesn't show it by default. |
We should fix the
|
Thank you very much. Yes, we are working on the pre-processing to re-map the IDs now. As it relates to the generation of new IDs in generate_stix20_id, to pass in a None value assumes that the existing ID follows a suggested practice in Stix1. It would be helpful if there was a way to handle this so that if the regex search in the method fails to extract a value for stix20_so_name from the ID, it would put some string value for stix20_so_name instead of trying to create a string to return with a None value (which causes a Type Error exception). Sorry for the mixup with my previous note here. |
We should definitely fix the bug when you pass in I'm tempted to hold off on the other things for now, since it sounds like you are working on your own methods of addressing that. Thanks so much for reporting this, @tigerkatz ! |
We are working to convert a repository of STIX 1 data to STIX 2 and plan to use the stix2elevator project. We have encountered an issue with some objects using ‘idref’ for objects that are outside of the package, but in the DB. It seems the stix2elevator is replacing these idrefs with a new identifier. Clearly the stix2elevator can not possibly map these IDs as it does not have access to the data outside the package. However, generating new IDs for these unresolvable refs seems like a problem.
This becomes an issue when stix2 IDs are created for relationship references like in stix_convert.py : fix_relationships on line 533:
if reference_needs_fixing(ref["target_ref"]): if not exists_id_key(ref["target_ref"]): new_id = generate_stix20_id(None, str.lower(ref["target_ref"]))
Additionally, our IDs follow the
<name space>:<type>-<zero padded integer>
pattern rather than the suggested practice of<name space>:<type>-<GUID>
. This is causing a None Type Error when the elevator tries to create a stix2 ID for these references in ids.py : generate_stix20_id line 75:`warn("Malformed id %s. Generated a new uuid", 605, stix12_id)
The text was updated successfully, but these errors were encountered: