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: set up sandbox for script execution [INS-3378] #6991

Closed
wants to merge 35 commits into from

Conversation

ihexxa
Copy link
Contributor

@ihexxa ihexxa commented Jan 17, 2024

Changes:
This change basically sets up a sandbox which is an isolated environment for executing scripts, it contains following changes:

  • modified building config for building index.js for the sandbox
    • packages/insomnia/esbuild.main.ts
    • packages/insomnia/vite.config.ts
  • introduced sandbox renderer
    • packages/insomnia/src/preload.ts
    • packages/insomnia/src/renderers/hidden-browser-window/index.ts
    • packages/insomnia/src/renderers/hidden-browser-window/inso-object.ts
    • packages/insomnia/src/renderers/hidden-browser-window/index.html
  • sandbox creating (in the main.js)
    • packages/insomnia/src/main/window-utils.ts
    • packages/insomnia/src/main/ipc/hidden-browser-window.ts
  • sandbox controlling (starting, closing)
    • packages/insomnia/src/ui/window-message-handlers.ts
    • packages/insomnia/src/global.d.ts
    • packages/insomnia/src/ui/index.tsx
  • misc (tests, debugging)
    • packages/insomnia-smoke-test/tests/smoke/pre-request-script.test.ts.
    • packages/insomnia-smoke-test/tests/smoke/oauth-gitlab.test.ts
    • packages/insomnia-smoke-test/tests/smoke/git-sync.test.ts

@ihexxa ihexxa changed the title feat: set up sandbox for script execution feat: set up sandbox for script execution [INS-3378] Jan 17, 2024
@jackkav
Copy link
Contributor

jackkav commented Jan 17, 2024

We should document the intended lifetime of the hidden browser window, eg. app start->app close or per function call, or whatever.

@ihexxa
Copy link
Contributor Author

ihexxa commented Jan 18, 2024

@jackkav It sounds reasonable, I've updated its design and workflow in the doc, please have a look.

@ihexxa
Copy link
Contributor Author

ihexxa commented Jan 25, 2024

Will create a naive version for this.

@ihexxa ihexxa closed this Jan 25, 2024
@jackkav jackkav reopened this Feb 5, 2024
hiddenBrowserWindow.loadURL(hiddenBrowserWindowUrl);

console.log(
`[main][init hidden win step 1/6]: starting hidden browser window(id=${hiddenBrowserWindow.id}): `,

Check notice

Code scanning / Semgrep OSS

Semgrep Finding: javascript.lang.security.audit.unsafe-formatstring.unsafe-formatstring Note

Detected string concatenation with a non-literal variable in a util.format / console.log function. If an attacker injects a format specifier in the string, it will forge the log message. Try to use constant values for the format string.
@jackkav
Copy link
Contributor

jackkav commented Feb 13, 2024

closing as a spike, merged in #7063 #7065

@jackkav jackkav closed this Feb 13, 2024
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.

2 participants