attack-stix-data icon indicating copy to clipboard operation
attack-stix-data copied to clipboard

Use valid UUID4 for x-mitre-collection ID

Open dandye opened this issue 1 year ago • 0 comments

#3 #close

This is a follow-on for #3. The previous invalid UUID4 used for the ID for x-mitre-collection:

x-mitre-collection--23320f4-22ad-8467-3b73-ed0c869a12838
x-mitre-collection--12345678-1234-4321-1234-1234567890ab
x-mitre-collection--xxxxxxxx-xxxx-4xxx-xxxx-xxxxxxxxxxxx

...was updated in #13 to be:

x-mitre-collection--402e24b4-436e-4936-b19b-2038648f489

...but this is also an invalid UUID4:

x-mitre-collection--402e24b4-436e-4936-b19b-2038648f489
x-mitre-collection--12345678-1234-4321-1234-1234567890ab
x-mitre-collection--xxxxxxxx-xxxx-4xxx-xxxx-xxxxxxxxxxxx
python -c 'from uuid import UUID; print(UUID("402e24b4-436e-4936-b19b-2038648f489", version=4))'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/opt/anaconda3/lib/python3.7/uuid.py", line 160, in __init__
    raise ValueError('badly formed hexadecimal UUID string')
ValueError: badly formed hexadecimal UUID string

This PR fixes it by appending 0 to the each occurrence of that ID:

grep -rl '"x-mitre-collection--402e24b4-436e-4936-b19b-2038648f489"' . | \
xargs sed -i '' \
-e 's/"x-mitre-collection--402e24b4-436e-4936-b19b-2038648f489"/"x-mitre-collection--402e24b4-436e-4936-b19b-2038648f4890"/g'

This is now a valid UUID4:

x-mitre-collection--402e24b4-436e-4936-b19b-2038648f4890
x-mitre-collection--12345678-1234-4321-1234-1234567890ab
x-mitre-collection--xxxxxxxx-xxxx-4xxx-xxxx-xxxxxxxxxxxx
python -c 'from uuid import UUID; print(UUID("402e24b4-436e-4936-b19b-2038648f4890", version=4))'
402e24b4-436e-4936-b19b-2038648f4890

dandye avatar Sep 14 '22 01:09 dandye