github-advanced-security[bot] commented on code in PR #941:
URL: https://github.com/apache/cordova-lib/pull/941#discussion_r1887771173
##########
src/cordova/platform/addHelper.js:
##########
@@ -226,7 +228,8 @@
if (modifiedPkgJson === true) {
const file = fs.readFileSync(pkgJsonPath, 'utf8');
const indent = detectIndent(file).indent || ' ';
- fs.writeFileSync(pkgJsonPath, JSON.stringify(pkgJson,
null, indent), 'utf8');
+ const newline = detectNewline(file);
+ fs.writeFileSync(pkgJsonPath, stringifyPackage(pkgJson,
indent, newline), 'utf8');
Review Comment:
## Potential file system race condition
The file may have changed since it [was checked](1).
[Show more
details](https://github.com/apache/cordova-lib/security/code-scanning/8)
##########
src/cordova/platform/remove.js:
##########
@@ -71,7 +73,8 @@
if (modifiedPkgJson === true) {
const file = fs.readFileSync(pkgJsonPath, 'utf8');
const indent = detectIndent(file).indent || ' ';
- fs.writeFileSync(pkgJsonPath, JSON.stringify(pkgJson,
null, indent), 'utf8');
+ const newline = detectNewline(file);
+ fs.writeFileSync(pkgJsonPath, stringifyPackage(pkgJson,
indent, newline), 'utf8');
Review Comment:
## Potential file system race condition
The file may have changed since it [was checked](1).
[Show more
details](https://github.com/apache/cordova-lib/security/code-scanning/9)
##########
src/cordova/plugin/remove.js:
##########
@@ -145,7 +147,8 @@
// Write out new package.json with plugin removed correctly.
const file = fs.readFileSync(pkgJsonPath, 'utf8');
const indent = detectIndent(file).indent || ' ';
- fs.writeFileSync(pkgJsonPath, JSON.stringify(pkgJson, null,
indent), 'utf8');
+ const newline = detectNewline(file);
+ fs.writeFileSync(pkgJsonPath, stringifyPackage(pkgJson, indent,
newline), 'utf8');
Review Comment:
## Potential file system race condition
The file may have changed since it [was checked](1).
[Show more
details](https://github.com/apache/cordova-lib/security/code-scanning/10)
##########
src/cordova/plugin/add.js:
##########
@@ -154,7 +156,8 @@
// Write to package.json
const file = fs.readFileSync(pkgJsonPath, 'utf8');
const indent = detectIndent(file).indent || ' ';
- fs.writeFileSync(pkgJsonPath,
JSON.stringify(pkgJson, null, indent), 'utf8');
+ const newline = detectNewline(file);
+ fs.writeFileSync(pkgJsonPath,
stringifyPackage(pkgJson, indent, newline), 'utf8');
Review Comment:
## Potential file system race condition
The file may have changed since it [was checked](1).
[Show more
details](https://github.com/apache/cordova-lib/security/code-scanning/11)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]