Skip to content
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

feat: Account for Node security patch #1778

Merged
merged 4 commits into from
Feb 18, 2025
Merged

feat: Account for Node security patch #1778

merged 4 commits into from
Feb 18, 2025

Conversation

@codecov-commenter
Copy link

codecov-commenter commented Feb 10, 2025

Codecov Report

Attention: Patch coverage is 0% with 1 line in your changes missing coverage. Please review.

Project coverage is 72.50%. Comparing base (eb0f002) to head (431497d).

Files with missing lines Patch % Lines
lib/check_reqs.js 0.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1778   +/-   ##
=======================================
  Coverage   72.50%   72.50%           
=======================================
  Files          23       23           
  Lines        1837     1837           
=======================================
  Hits         1332     1332           
  Misses        505      505           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@erisu erisu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you confirm if this change is valid?

The article you're linking is about Node.js spawn while the code appears to be using the npm package execa and the README for version 5.1.1 of this package does not to mention spawn as a valid option.

@erisu
Copy link
Member

erisu commented Feb 10, 2025

The article is talking about the shell option and the execa package does have this flag.

https://www.npmjs.com/package/execa/v/5.1.1#shell

Bit curious, since the dependency suggests setting it is

unsafe, potentially allowing command injection.

But since we are defining the bat file and not taking in user arg, it should be OK.

@breautek
Copy link
Contributor

breautek commented Feb 10, 2025

The article is talking about the shell option and the execa package does have this flag.

https://www.npmjs.com/package/execa/v/5.1.1#shell

Bit curious, since the dependency suggests setting it is

unsafe, potentially allowing command injection.

But since we are defining the bat file and not taking in user arg, it should be OK.

I assume execa is using spawn behind-the-scenes, and it's generally recommended to not enable shell because it can be a security concern:

This is from the NodeJS docs

If the shell option is enabled, do not pass unsanitized user input to this function. Any input containing shell metacharacters may be used to trigger arbitrary command execution.

The security concern arises if we are passing in user supplied values, which we are not:

path.join(__dirname, 'getASPath.bat')

path is a NodeJS API, and __dirname is a module-level NodeJS variable, concating
hard-coded string getASPath.bat. So I think using shell option here is safe.

I do think we should comment why we are using shell though so that someone else doesn't remove it for optimization or to "harden" reasons.

kant2002 and others added 2 commits February 11, 2025 12:45
Co-authored-by: Norman Breau <norman@breautek.com>
@@ -110,7 +110,9 @@ module.exports.get_gradle_wrapper = function () {
let program_dir;
// OK, This hack only works on Windows, not on Mac OS or Linux. We will be deleting this eventually!
if (module.exports.isWindows()) {
const result = execa.sync(path.join(__dirname, 'getASPath.bat'));
// "spawn" option enabled for CVE-2024-27980 (Windows) Mitigation
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// "spawn" option enabled for CVE-2024-27980 (Windows) Mitigation
// "shell" option enabled for CVE-2024-27980 (Windows) Mitigation

I wrote in "spawn" because that was in the original PR but since we determine the "shell" option is correct, that should be reflected in the comment too.

@erisu erisu changed the title Account for Node security patch feat: Account for Node security patch Feb 14, 2025
Copy link
Member

@erisu erisu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes looks good to me.

@erisu erisu added this to the 14.0.0 milestone Feb 14, 2025
@erisu erisu merged commit 8f458b0 into apache:master Feb 18, 2025
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cannot read property 'toString' of null with cordova-android v8
4 participants