TcM1911 / stix2

A pure Go library for working with Structured Threat Information Expression (STIX™) version 2.x data
BSD 2-Clause "Simplified" License
22 stars 6 forks source link

Potential Extension Error #60

Closed wrbrant closed 9 months ago

wrbrant commented 1 year ago

extension_types does not write out to a file correctly. Instead, it returns a base64 encoded string that, from what I can tell, does not map to its original string. As another example, ["property-extension"] becomes "BA==". This issue is only in "extension_types" in the extension-definition, not in "extension-type" found in standard STIX object.

Here is the code. The assignment of "e" to NewExtensionDefinition is copied directly from the extension_test.go, lines 81-88: Screenshot from 2023-07-15 14-29-55

Here is the terminal output: Screenshot from 2023-07-15 14-30-46

Here is the file output: Screenshot from 2023-07-15 14-31-30

TcM1911 commented 1 year ago

I think I've missed to implement the MarshalJSON interface for the type. Do you want to see if that fixes the issue?

wrbrant commented 1 year ago

It does fix it. I have cloned the repository, created a branch, and added the fix. Can I push it to origin and make a merge request?

TcM1911 commented 1 year ago

Yes go ahead and create a PR. Please include a test as part of the fix. Thanks.

wrbrant commented 1 year ago

I do not believe I have the necessary perms. I admit I am not too familiar with pushing to repositories that I do not in some way own, but right now when I attempt to push my branch to origin, I am given an error 403.

TcM1911 commented 9 months ago

Pull the latest release for the fix.