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

convert xccdf_results2hdf: TypeError: Cannot read properties of undefined (reading 'match') #1183

Open
candrews opened this issue Mar 10, 2023 · 7 comments · May be fixed by mitre/heimdall2#4254

Comments

@candrews
Copy link
Contributor

Given this report.xml (which is, as far as I can, a valid xccdf report produced by openscap) run:
npx @mitre/[email protected] convert xccdf_results2hdf -i report.xml -o report.hdf

Expected:
The conversion should complete successfully.

Actual:

$ npx @mitre/[email protected] convert xccdf_results2hdf -i report.xml -o report.hdf
(node:86425) NOTE: We are formalizing our plans to enter AWS SDK for JavaScript (v2) into maintenance mode in 2023.

Please migrate your code to use AWS SDK for JavaScript (v3).
For more information, check the migration guide at https://a.co/7PzMCcy
(Use `node --trace-warnings ...` to show where the warning was created)
    TypeError: Cannot read properties of undefined (reading 'match')
[1]

The conversion failed with TypeError: Cannot read properties of undefined (reading 'match')

@candrews
Copy link
Contributor Author

@aaronlippold or anyone else - can you please take a look at this error? It's very easy to reproduce, so hopefully that helps with resolving it quickly.

@candrews
Copy link
Contributor Author

It appears this bug is in @mitre/hdf-converters, and I found the source for that package at https://github.com/mitre/heimdall2/tree/master/libs/hdf-converters

@candrews
Copy link
Contributor Author

The only place where match is read/called is https://github.com/mitre/heimdall2/blob/v2.6.41/libs/hdf-converters/src/xccdf-results-mapper.ts#L190 so that must be where this error occurs.

@em-c-rod
Copy link
Contributor

Thank you @candrews for the issue and for uploading the results file. Which SCAP content and profile were you running? That way we can reproduce it on our side because this file looks different than others we have seen.

@em-c-rod
Copy link
Contributor

mitre/heimdall2#4254

@em-c-rod em-c-rod linked a pull request Mar 23, 2023 that will close this issue
3 tasks
@candrews
Copy link
Contributor Author

Which SCAP content and profile were you running? That way we can reproduce it on our side because this file looks different than others we have seen.

This file was generated using this comment:
oscap-podman ubuntu:18.04 xccdf eval --results report.xml --profile xccdf_org.ssgproject.content_profile_cis /usr/share/xml/scap/ssg/content/ssg-ubuntu1804-ds.xml

/usr/share/xml/scap/ssg/content/ssg-ubuntu1804-ds.xm is provided by https://github.com/ComplianceAsCode/content/releases/tag/v0.1.66 which is packaged in Fedora as scap-security-guide as well as in many other distributions.

@candrews
Copy link
Contributor Author

I think this problem is really an indicator of the converter not implementing major parts of the XCCDF specification correctly, including nested groups. I've submitted an MR which implements that feature, fixes this issue, and makes other improvements: mitre/heimdall2#4255

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants