Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve xccdf_results_mapper when converting XCCDF Results to HDF Res…
…ults (#4255) * Improve xccdf_results_mapper when converting XCCDF->HDF * Support XCCDF generated using ComplianceAsCode: https://github.com/ComplianceAsCode/content/ * Support nested XCCDF groups * Set `code_desc` to an appropriate value (not empty string) * Refactor to remove global variables Bug: mitre/saf#1163 Fixes: #4194 * Minor changes requested by code review * Use the "RegExp.exec()" method instead Address sonar finding typescript:S6594 * Set impact to 0 for 'notapplicable' and 'informational' results * Don't handle every array item within each array item In handleArray, the array v is looped over. For each item, the entire array is looped over again, resulting in an array v of length n resulting in an output array of length n^2, making handleArray's complexity O(n^2). However, that n^2 looping is unnecessary. Removing it brings the complexity of handleArray down to O(n), drastically reducing execution time. * "version" should use "version.text" (not just "version") * For version, prefer version over id * For version, remove unnecessary comment * Remove unnecessary String conversion * Add tsdoc to getRulesInGroup * removed 'id' as a potential path for 'version'. the complianceascode sample doesn't contain that attribute at all -> we should not have a tag for it. also updated samples but these samples updates also include changes from the baseconverter updates so warrant inspection esp for the complianceascode sample output Signed-off-by: Amndeep Singh Mann <[email protected]> * linting Signed-off-by: Amndeep Singh Mann <[email protected]> * Use triple equals for string comparson * Various fixes * Correct "refs" to comply with schema * Only include description if it has a label * make the nist family part of the regexes only match against valid nist control families Signed-off-by: Amndeep Singh Mann <[email protected]> * Use `as unknown as ControlDescription` instead of `as any` * Run lint on src/nist.ts Fixes linting issues introduced in 587282d * Regenerate samples Updates samples after 587282d * Use concise character class syntax '\d' instead of '[0-9]'. Addresses sonar finding typescript:S6353 * the treemap expects a canonized form of the nist controls that are not 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]> * get rid of dupe nist tags - even if there were dupes in the original 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]> * could simplify the default_partial_config implementation and also ran the linter Signed-off-by: Amndeep Singh Mann <[email protected]> * sonarqube Signed-off-by: Amndeep Singh Mann <[email protected]> --------- Signed-off-by: Amndeep Singh Mann <[email protected]> Co-authored-by: Aaron Lippold <[email protected]> Co-authored-by: Amndeep Singh Mann <[email protected]>
- Loading branch information