Skip to content

Commit cb2ea70

Browse files
authored
Merge pull request #364 from sf-pallavi-das/u/pallavi-das/security_scan_fixes
fix: @W-19244073 Updating packages after security scan
2 parents f50c99a + 138ba4a commit cb2ea70

File tree

6 files changed

+46
-12
lines changed

6 files changed

+46
-12
lines changed

messages/assess.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@
4242
"processingDataRaptor": "Processing DataMapper: %s",
4343
"processingOmniScript": "Processing OmniScript: %s",
4444
"processingGlobalAutoNumber": "Processing GlobalAutoNumber: %s",
45-
"foundDataRaptorsToAssess": "Found %s DataRaptors to assess",
45+
"foundDataRaptorsToAssess": "Found %s DataMappers to assess",
4646
"foundOmniScriptsToAssess": "Found %s %s to assess",
4747
"foundGlobalAutoNumbersToAssess": "Found %s GlobalAutoNumbers to assess",
48-
"startingDataRaptorAssessment": "Starting DataRaptor assessment",
48+
"startingDataRaptorAssessment": "Starting DataMapper assessment",
4949
"startingOmniScriptAssessment": "Starting %s assessment",
5050
"startingGlobalAutoNumberAssessment": "Starting GlobalAutoNumber assessment",
5151
"allVersionsInfo": "allVersions : %s",

package.json

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
"@types/jsdom": "^21.1.7",
1616
"@types/lodash.chunk": "^4.2.9",
1717
"@types/shelljs": "^0.8.15",
18+
"@xmldom/xmldom": "^0.9.8",
1819
"cli-progress": "^3.12.0",
1920
"diff": "^5.1.0",
2021
"jsdom": "^25.0.0",
@@ -23,8 +24,7 @@
2324
"shelljs": "^0.8.5",
2425
"tslib": "^2",
2526
"@babel/parser": "^7.25.6",
26-
"@babel/traverse": "^7.25.6",
27-
"xmldom": "^0.6.0"
27+
"@babel/traverse": "^7.25.6"
2828
},
2929
"devDependencies": {
3030
"@oclif/dev-cli": "^1",
@@ -38,6 +38,7 @@
3838
"@salesforce/ts-sinon": "^1",
3939
"@types/babel__traverse": "^7.20.6",
4040
"@types/jsforce": "^1.11.5",
41+
"@types/xmldom": "^0.1.34",
4142
"@typescript-eslint/eslint-plugin": "^4.2.0",
4243
"@typescript-eslint/parser": "^4.2.0",
4344
"chai": "^4.4.1",
@@ -63,6 +64,37 @@
6364
"ts-node": "^10.9.2",
6465
"typescript": "^4.9.5"
6566
},
67+
"resolutions": {
68+
"nanoid": "^3.3.8",
69+
"marked": "^4.0.10",
70+
"semver": "^7.5.2",
71+
"jsonwebtoken": "^9.0.2",
72+
"form-data": "^4.0.4",
73+
"trim-newlines": "^3.0.1",
74+
"minimatch": "^3.0.5",
75+
"tough-cookie": "^4.1.3",
76+
"ansi-regex": "^4.1.1",
77+
"json5": "^2.2.2",
78+
"braces": "^3.0.3",
79+
"ejs": "^3.1.10",
80+
"micromatch": "^4.0.8",
81+
"path-to-regexp": "^1.9.0",
82+
"@babel/runtime-corejs3": "^7.26.10",
83+
"@babel/runtime": "^7.26.10",
84+
"@babel/helpers": "^7.26.10",
85+
"cross-spawn": "^7.0.5",
86+
"tar-fs": "^2.1.3",
87+
"brace-expansion": "^2.0.2",
88+
"tmp": "^0.2.4",
89+
"request": "^2.88.2",
90+
"lodash.template": "^4.5.0",
91+
"@babel/types": "^7.25.6",
92+
"@babel/traverse": "^7.25.6",
93+
"@babel/parser": "^7.25.6",
94+
"@babel/core": "^7.25.6",
95+
"@babel/template": "^7.25.6",
96+
"xml2js": "^0.5.0"
97+
},
6698
"engines": {
6799
"node": ">=12.0.0"
68100
},

src/utils/XMLUtil.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
1111
/* eslint-disable @typescript-eslint/no-explicit-any */
1212

13-
import { DOMParser, XMLSerializer } from 'xmldom';
13+
import { DOMParser, XMLSerializer } from '@xmldom/xmldom';
1414

1515
/**
1616
* XMLUtil provides XML parsing and building functionality using the xmldom library.
@@ -51,14 +51,14 @@ export class XMLUtil {
5151
// Parse XML string to JSON
5252
public parse(xmlString: string): any {
5353
const doc = this.parser.parseFromString(xmlString, 'text/xml');
54-
return this.xmlToJson(doc.documentElement);
54+
return this.xmlToJson(doc.documentElement as any);
5555
}
5656

5757
// Convert JSON object to XML
5858
public build(jsonObject: any, rootElement = 'root'): string {
5959
const doc = new DOMParser().parseFromString(`<${rootElement}></${rootElement}>`, 'text/xml');
6060
const rootNode = doc.documentElement;
61-
this.jsonToXml(jsonObject, rootNode);
61+
this.jsonToXml(jsonObject, rootNode as unknown as Node);
6262
return this.xmlHeader + this.prettyPrintXml(this.serializer.serializeToString(doc));
6363
}
6464

src/utils/lwcparser/xmlParser/XmlParser.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
77
/* eslint-disable @typescript-eslint/explicit-member-accessibility */
88
import * as fs from 'fs';
9-
import { DOMParser, XMLSerializer } from 'xmldom';
9+
import { DOMParser, XMLSerializer, Document } from '@xmldom/xmldom';
1010
import { FileConstant } from '../fileutils/FileConstant';
1111
import { Logger } from '../../logger';
1212

@@ -51,6 +51,8 @@ export class XmlParser {
5151
xmlContentMap.set(FileConstant.MODIFIED_CONTENT, xmlString);
5252
return xmlContentMap;
5353
}
54+
55+
return xmlContentMap;
5456
}
5557

5658
public saveToFile(outputFilePath: string, xmlString: string): void {

test/utils/XMLUtil.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,13 +93,13 @@ describe('XMLUtil', () => {
9393
});
9494
});
9595

96-
it('should handle invalid XML gracefully', () => {
96+
it('should throw for invalid xml', () => {
9797
const invalidXml = '<root><unclosed>';
9898

99-
// xmldom doesn't throw errors, it returns a document with errors
99+
// xmldom to throw error for mismatched tags after package update to @xmldom/xmldom.
100100
expect(() => {
101101
xmlUtil.parse(invalidXml);
102-
}).to.not.throw();
102+
}).to.throw();
103103
});
104104
});
105105

yarn.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7126,4 +7126,4 @@ zip-stream@^4.1.0:
71267126
dependencies:
71277127
archiver-utils "^2.1.0"
71287128
compress-commons "^4.1.0"
7129-
readable-stream "^3.6.0"
7129+
readable-stream "^3.6.0"

0 commit comments

Comments
 (0)