-
Notifications
You must be signed in to change notification settings - Fork 63
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
Improve xccdf_results_mapper when converting XCCDF Results to HDF Results #4255
Improve xccdf_results_mapper when converting XCCDF Results to HDF Results #4255
Conversation
dfeb1a9
to
326a8ba
Compare
Hi the team @Amndeep7 @em-c-rod @wdower @Hookwitz @georgedias are looking over this and seeing if some of our other PR work can be rolled into this as well. A couple questions:
|
@candrews looks like SonarCloud is also unhappy about something - which we may want to poke at as well as doing a rebase from master/main |
Question: Is any of the work here also useful or overtaken by this PR? #2958 |
592a324
to
47f4747
Compare
I fixed the SonarCloud findings. The only finding now is in the test for a comment (the same comment is in every other test, so I think it should be in this one as well) and I believe that finding should be suppressed. |
Can I do something to help this along? I'd really like to have these issues fixed soon as it's blocking progress on a project which is import to my corporate overlords. |
Sorry for the delay @candrews - could you address the findings for the HDF-Converters tests? It seems like some of the other XML mappers such as the Veracode are now having issues. Also now that I've enabled workflows in the repo, they should continue to be enabled for this PR, but shoot me a ping if they aren't after you push up some changes. |
Another point that I wanted to bring up was that we were intending on eventually rewriting this mapper to use jsonix to be able to match against the XCCDF schema properly instead of using the fast-xml-parser which has issues with (for example) determining the difference between singular nodes and arrays of length one. This isn't a request for you to rework this entire PR to use that other library, just a heads up about part of the delay in dealing with this mapper since we're still exploring how to use jsonix and write a mapper properly with it in our checklist mapper work (#3859). |
Still need to finish reading/reviewing the code, which I'll try to do next week. Also @candrews - it would be really nice if we could arrange a meeting to discuss how you and your corporate overlords are using HDF-Converters / the SAF. We don't do any tracking, so we gotta go the old fashioned way and actually talk to our users in order to learn how/why they're using our stuff, and what we could do to deepen the partnership. If you could email me at [email protected] with some dates/times that you/your team/your management chain are available, I'd appreciate it a lot. |
This pull request has a conflict. Could you fix it @candrews? |
47f4747
to
adf7131
Compare
I've addressed the conflict. |
@Amndeep7 I believe that I have addressed all the feedback. As you know, I'm not terribly familiar with the heimdall tool, but with that disclaimer, I think the output looks good and is definitely improvement over when we last looked at this together. Can you please take another look and let me know what else needs to be done? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Feeling like this should probably be able to be merged in after this final set of changes is made. Thanks for bearing with the process for so long.
.map((x) => x.text) | ||
.map(parse_nist) | ||
.filter((x) => !!x) | ||
.filter(is_control) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is_control(parse_nist('SV-86515'))
return true... so as far as inspectjs is concerned, 'SV-86515' is a nist control and therefore should be included.
Am I misunderstanding nist.js
? How should I determine if an item should be included or excluded from this list?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this feels like a failure on inspecjs' part in not removing things that are clearly wrong. parse_nist should throw errors/explicitly fail when they are not nist controls/control families. it not doing so confuses the type system by mistakenly typing that string. is_control more or less is only used to narrow down types and doesn't do much actual validation.
anyways as shown there and in 'raw_nist.ts', nist controls look like 'two_letter_family-small_number possibly followed by letters and numbers in parentheses' whereas stig ids are 'S?V-5__or_6_digit_number'.
the issue that arose here is that it thinks 'sv' is a control family and then processes the numbers after it as like 'control "big number" from within that control family' but doesn't take into account the reality of the situation where 'sv' is not a valid control family nor is there a control with an index as high as '86515' in existence.
looking briefly, it seems like the regexes that parse_nist uses are vastly broader than the actually allowed set of inputs. i will experiment to see if it's possible to restrict it to allowed control families.
Using However... If this issue in the xml parser is fixed, then modifying constructor(scapXml: string, withRaw = false) {
super(
parseXml(scapXml, {
stopNodes: [
'*.fixtext',
'*.fix',
'*.rationale',
'*.warning',
'*.title',
'*.description'
]
})
); would solve the html parsing problem. |
…t control families Signed-off-by: Amndeep Singh Mann <[email protected]>
@Amndeep7 do you have a guess as to when we'll be able to progress this PR? |
Sorry I've been swamped this week. I'll try to take a look next week to fix that bug in Heimdall that I mentioned. |
…t zero-padded. also changed default behaviors so there's no need to supply a parameter to the canonize function at all. Signed-off-by: Amndeep Singh Mann <[email protected]>
…file, it makes no sense to have that replicated here anymore really - there are some particularly egregious cases too where a control is replicated at least 3 times in the array Signed-off-by: Amndeep Singh Mann <[email protected]>
… the linter Signed-off-by: Amndeep Singh Mann <[email protected]>
Signed-off-by: Amndeep Singh Mann <[email protected]>
This pull request has a conflict. Could you fix it @candrews? |
Signed-off-by: Amndeep Singh Mann <[email protected]>
Kudos, SonarCloud Quality Gate passed!
|
Thank you for your patience and hard work on this PR @candrews. You did some absolutely fantastic work here that'll be appreciated across many of the users of Heimdall. |
code_desc
to an appropriate value (not empty string)Bug: mitre/saf#1163
Fixes: #4194