Skip to content

Commit

Permalink
Export variables representing magic strings to be used in NIST2CCI fu…
Browse files Browse the repository at this point in the history
…nction

Signed-off-by: Joyce Quach <[email protected]>
  • Loading branch information
jtquach1 committed Nov 5, 2024
1 parent 16024cd commit 11d47a7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 2 additions & 2 deletions libs/hdf-converters/data/converters/cciListXml2json.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ if (scriptIsCalled) {
}
}

const CCIS_KEY = 'ccis';
export const CCIS_KEY = 'ccis';
export const DELIMITER = ' ';

type Leaf = {
[CCIS_KEY]?: string[];
Expand All @@ -134,7 +135,6 @@ export function removeParentheses(key: string): string {
}

function unflatten(fullNistPathToListOfCcis: Record<string, string[]>): Trie {
const DELIMITER = ' ';
const result = {};
const keys = _.keys(fullNistPathToListOfCcis);
for (const key of keys) {
Expand Down
8 changes: 6 additions & 2 deletions libs/hdf-converters/src/mappings/CciNistMapping.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ import _ from 'lodash';
import {NIST_TO_CCI} from '../mappings/NistCciMappingData';
import {is_control, parse_nist} from 'inspecjs';
import {CCI_TO_NIST} from './CciNistMappingData';
import {removeParentheses} from '../../data/converters/cciListXml2json';
import {
CCIS_KEY,
DELIMITER,
removeParentheses
} from '../../data/converters/cciListXml2json';

export function CCI2NIST(
identifiers: string[],
Expand All @@ -29,7 +33,7 @@ export function NIST2CCI(
collapse = true
): string[] {
const DEFAULT_CCI_TAGS = defaultNist2Cci || [];
const createPath = (nist: string) => [...nist.split(' '), 'ccis'];
const createPath = (nist: string) => [...nist.split(DELIMITER), CCIS_KEY];
const nists = identifiers.map(parse_nist);
const controls = nists.filter(is_control);
const paths = controls.map((control) =>
Expand Down

0 comments on commit 11d47a7

Please sign in to comment.