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

Electron 29: Warning on 'Node.js environment variables are disabled because this process is invoked by other apps.' #30239

Closed
jennifer-shehane opened this issue Sep 13, 2024 · 3 comments
Labels
pkg/electron This is due to an issue in the packages/electron directory

Comments

@jennifer-shehane
Copy link
Member

What would you like?

Seeing this warning in Electron 29 tests here: https://app.circleci.com/pipelines/github/cypress-io/cypress/64069/workflows/1cbb1422-c586-4814-96a2-3414e0d7f397/jobs/2657028

[0913/132025.057522:ERROR:node_main.cc(145)] Node.js environment variables are disabled because this process is invoked by other apps.

This is due to a change in Electron 29 from this PR: electron/electron#40579

    // On macOS, it is forbidden to run sandboxed app with custom arguments
    // from another app, i.e. args are discarded in following call:
    //   exec("Sandboxed.app", ["--custom-args-will-be-discarded"])
    // However it is possible to bypass the restriction by abusing the node mode
    // of Electron apps:
    //   exec("Electron.app", {env: {ELECTRON_RUN_AS_NODE: "1",
    //                               NODE_OPTIONS: "--require 'bad.js'"}})
    // To prevent Electron apps from being used to work around macOS security
    // restrictions, when NODE_OPTIONS is passed it will be checked whether
    // this process is invoked by its own app.
    if (!ProcessBelongToCurrentApp(getppid())) {
      LOG(ERROR) << "NODE_OPTIONS is disabled because this process is invoked "
                    "by other apps.";
      node_options_enabled = false;
    }
  }

This behavior was refined in Electron 30 here: electron/electron#41079

Users will not like to see this error if this is present when running Cypress in Electron 29.

Why is this needed?

.

Other

No response

@MikeMcC399
Copy link
Contributor

electron/electron#41079 was backported to Electron 29 in electron/electron#41102 and is listed in the release notes for https://releases.electronjs.org/release/v29.0.0 so I imagine that Electron 30 will not be an improvement. Maybe worth testing with Electron 30 (or later) anyway?

@jennifer-shehane jennifer-shehane added the pkg/electron This is due to an issue in the packages/electron directory label Sep 16, 2024
@jennifer-shehane
Copy link
Member Author

I suppose. Electron 29 will need to be a breaking change we've decided, so I guess we could try 30 while we're at it.

@MikeMcC399
Copy link
Contributor

@jennifer-shehane

Electron 29 will need to be a breaking change we've decided, so I guess we could try 30 while we're at it.

  • Due to the delay in getting the external workaround (Spike: Can't upgrade Electron due to v8 snapshot issues #29960) Electron 29 has now slipped into end-of-life. Electron 30 also soon transitions into end-of-life. Is there a possibility to jump to a later Electron version if it's going to be a breaking change anyway or is this too much of a leap to consider Electron 31 or 32?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg/electron This is due to an issue in the packages/electron directory
Projects
None yet
Development

No branches or pull requests

2 participants