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

BUG: XML SWID tags fail to parse when hash attribute is present in File element #37

Open
carl-wallace opened this issue Jul 22, 2022 · 2 comments
Labels
bug Something isn't working

Comments

@carl-wallace
Copy link

What version of the package are you using?

Current

Does this issue reproduce with the latest release?

Yes

What OS and CPU architecture are you using (go env)?

GOARCH="amd64"
GOOS="darwin"

GOHOSTARCH="amd64"
GOHOSTOS="darwin"

What did you do?

Tried parsing XML SWID tags generated using NIST's swid-tools and StrongSwan's swidGenerator using the FromXML method on swid.SoftwareIdentity.

What did you expect to see?

I expected it to successfully parse.

What did you see instead?

An error indicating bad format: expecting :

An issue is that the codify invocation at https://github.com/veraison/swid/blob/main/hashentry.go#L216 is expecting : but is being passed . If the SWID tag is modified to include SHA256: in the value, for example, parsing is successful.

Additionally, there appears to be intolerance of multiple hash attributes. Two samples (one with one hash attribute and one with two) are below. When the sample with two hash attrs was modified as described above to parse successfully then serialized as JSON, only the second attribute was emitted.

@carl-wallace carl-wallace added the bug Something isn't working label Jul 22, 2022
@thomas-fossati
Copy link
Contributor

Thanks @carl-wallace for finding this.

In your report you say:

Two samples (one with one hash attribute and one with two) are below

but I don't know what samples you are referring to. Could you please clarify?

@carl-wallace
Copy link
Author

Weird. They were at the bottom of that text block (or at least I thought they were). I copied them into the attached file.
two_samples.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants