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

Preload doesn't load in sandboxed render if preload path contains special chars #12037

Merged
merged 5 commits into from Mar 7, 2018

Conversation

Projects
None yet
9 participants
@juturu
Contributor

juturu commented Feb 25, 2018

If preload file path contains special chars, load of preload in sandboxed renderer doesn't trigger.

@juturu juturu requested review from tarruda and codebytere Feb 25, 2018

@juturu juturu requested a review from electron/reviewers as a code owner Feb 25, 2018

@@ -160,9 +162,12 @@ void AtomSandboxedRendererClient::DidCreateScriptContext(
return;
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
std::string preload_script = command_line->GetSwitchValueASCII(
base::FilePath preload_script_path = command_line->GetSwitchValuePath(

This comment has been minimized.

@felixrieseberg
@ckerr

This comment has been minimized.

Member

ckerr commented Feb 26, 2018

I suspect some of these test failures are spurious, but am not sure about these:failed?

not ok 47 app module mixed sandbox option when app.enableMixedSandbox() is called adds --enable-sandbox to render processes created with sandbox: true
  Error: Timeout of 30000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves.
      at C:\projects\electron\spec\node_modules\mocha\lib\runnable.js:232:19
not ok 48 app module mixed sandbox option when the app is launched with --enable-mixed-sandbox adds --enable-sandbox to render processes created with sandbox: true
  Error: Timeout of 30000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves.
@deepak1556

LGTM, otherwise.

ipcRenderer.send('child-loaded', window.opener == null, document.body.innerHTML)
}, false)
}
})()

This comment has been minimized.

@deepak1556

deepak1556 Feb 27, 2018

Member

We are only testing for the successful load of this file with window.test variable, rest of the logic are irrelevant. Can you remove those ? Thanks!

@@ -15,6 +15,8 @@
#include "atom/renderer/api/atom_api_renderer_ipc.h"
#include "atom/renderer/atom_render_view_observer.h"
#include "base/command_line.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"

This comment has been minimized.

@deepak1556

deepak1556 Feb 27, 2018

Member

file_util header is not required.

test seems to be failing

@deepak1556

Thanks!

juturu added some commits Feb 24, 2018

@codebytere codebytere merged commit 2f4fd33 into master Mar 7, 2018

9 checks passed

WIP ready for review
Details
ci/circleci: electron-linux-arm Your tests passed on CircleCI!
Details
ci/circleci: electron-linux-arm-test Your tests passed on CircleCI!
Details
ci/circleci: electron-linux-arm64 Your tests passed on CircleCI!
Details
ci/circleci: electron-linux-arm64-test Your tests passed on CircleCI!
Details
ci/circleci: electron-linux-ia32 Your tests passed on CircleCI!
Details
ci/circleci: electron-linux-x64 Your tests passed on CircleCI!
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
jenkins: macOS/pr-head This commit looks good
Details

@codebytere codebytere deleted the sandbox_preload_file_path branch Mar 7, 2018

@miniak

This comment has been minimized.

Contributor

miniak commented Apr 17, 2018

@juturu this does not seem to be ported to 2.0 release branch, can you do that?

@alexeykuzmin

This comment has been minimized.

Contributor

alexeykuzmin commented Apr 17, 2018

/trop run backport-to 2-0-x

@codebytere

This comment has been minimized.

Member

codebytere commented Apr 17, 2018

/trop run backport-to 2-0-x

@trop

This comment has been minimized.

Contributor

trop bot commented Apr 17, 2018

The backport process for this PR has been manually initiated, sending your 1's and 0's to "2-0-x" here we go! :D

@trop

This comment has been minimized.

Contributor

trop bot commented Apr 17, 2018

An error occurred while attempting to backport this PR to "2-0-x", you will need to perform this backport manually

@alexeykuzmin

This comment has been minimized.

Contributor

alexeykuzmin commented Apr 17, 2018

this does not seem to be ported to 2.0 release branch, can you do that?

@miniak @juturu
I'll do it.

alexeykuzmin added a commit that referenced this pull request Apr 17, 2018

Preload doesn't load in sandboxed render if preload path contains spe…
…cial chars (#12037)

* Adding missing headers

* adding ut

* Removing the file path exists check

* fixing test

* exposing window.require in UT

(cherry picked from commit 2f4fd33)
@MarshallOfSound

This comment has been minimized.

Member

MarshallOfSound commented Apr 17, 2018

/trop run backport-to 2-0-x

@trop

This comment has been minimized.

Contributor

trop bot commented Apr 17, 2018

The backport process for this PR has been manually initiated, sending your 1's and 0's to "2-0-x" here we go! :D

@trop

This comment has been minimized.

Contributor

trop bot commented Apr 17, 2018

An error occurred while attempting to backport this PR to "2-0-x", you will need to perform this backport manually

ckerr added a commit that referenced this pull request Apr 17, 2018

Preload doesn't load in sandboxed render if preload path contains spe…
…cial chars (#12037) (#12643)

* Adding missing headers

* adding ut

* Removing the file path exists check

* fixing test

* exposing window.require in UT

(cherry picked from commit 2f4fd33)

sethlu added a commit to sethlu/electron that referenced this pull request May 3, 2018

Preload doesn't load in sandboxed render if preload path contains spe…
…cial chars (electron#12037)

* Adding missing headers

* adding ut

* Removing the file path exists check

* fixing test

* exposing window.require in UT

juturu added a commit that referenced this pull request May 21, 2018

Merged PR 142017: Preload doesn't load in sandboxed render if preload…
… path contains special chars

Preload doesn't load in sandboxed render if preload path contains special chars

This is also getting upstreamed via #12037
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment