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

Disable kernel auto startup in untrusted workspace #6088

Merged
merged 5 commits into from
Jun 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,67 @@ jobs:
- name: Check dependencies
run: npm run checkDependencies

vsc_api_check:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Created a separate Job that will test compilation against the latest type definition files.
This way we can have CI running and perfectly green until VS Code actually ships stuff.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For instance, I should have be able to run CI right now with the current VSC Insiders.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This will allow us to have both

needs: pick_environment
name: VSC Stable & Proposed API
runs-on: ${{ matrix.os }}
if: github.repository == 'microsoft/vscode-jupyter'
strategy:
fail-fast: false
matrix:
os: ${{fromJson(needs.pick_environment.outputs.test_matrix_os)}}
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Use Node ${{env.NODE_VERSION}}
uses: actions/setup-node@v2.1.5
with:
node-version: ${{env.NODE_VERSION}}

# Caching of npm packages (https://github.com/actions/cache/blob/main/examples.md#node---npm)
- name: Cache npm on linux/mac
uses: actions/cache@v2.1.4
if: matrix.os != 'windows-latest'
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-

- name: Get npm cache directory
if: matrix.os == 'windows-latest'
id: npm-cache
run: |
echo "::set-output name=dir::$(npm config get cache)"
- name: Cache npm on windows
uses: actions/cache@v2.1.4
if: matrix.os == 'windows-latest'
with:
path: ${{ steps.npm-cache.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-

- name: Cache compiled TS files
# Use an id for this step so that its cache-hit output can be accessed and checked in the next step.
id: out-cache
uses: actions/cache@v2.1.4
with:
path: ./out
key: ${{runner.os}}-${{env.CACHE_OUT_DIRECTORY}}-${{hashFiles('src/**')}}

- name: Install dependencies (npm ci)
run: npm ci --prefer-offline

- name: Install Stable + Proposed API
run: npm run download-api

- name: Compile if not cached
run: npx gulp prePublishNonBundle
env:
CI_JUPYTER_FAST_COMPILATION: 'true'

ts_tests:
needs: pick_environment
name: Type Script Tests
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1900,7 +1900,7 @@
"build-ipywidgets-compile": "tsc -p ./src/ipywidgets && rimraf ./out/tsconfig.tsbuildinfo && node ./src/ipywidgets/scripts/copyfiles.js",
"build-ipywidgets-webpack": "cross-env NODE_OPTIONS=--max_old_space_size=9096 webpack --config ./src/ipywidgets/webpack.config.js",
"checkDependencies": "gulp checkDependencies",
"postinstall": "npm run download-api && node ./build/ci/postInstall.js",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This should be done either as a separate job (optional that can fail).
Else we're all unable to submit PRs even when VS Code Insiders hasn't been updated.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

"postinstall": "node ./build/ci/postInstall.js",
"test:unittests": "mocha --config ./build/.mocha.unittests.js.json",
"test:functional": "mocha --require source-map-support/register --config ./build/.mocha.functional.json",
"test:functional:perf": "node --inspect-brk ./node_modules/mocha/bin/_mocha --require source-map-support/register --config ./build/.mocha.functional.perf.json",
Expand Down
7 changes: 6 additions & 1 deletion src/client/datascience/jupyter/serverPreload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
'use strict';
import { inject, injectable } from 'inversify';
import { IExtensionSingleActivationService } from '../../activation/types';
import { IWorkspaceService } from '../../common/application/types';
import { traceError, traceInfo } from '../../common/logger';
import { IConfigurationService } from '../../common/types';
import {
Expand All @@ -21,7 +22,8 @@ export class ServerPreload implements IExtensionSingleActivationService {
@inject(INotebookEditorProvider) private notebookEditorProvider: INotebookEditorProvider,
@inject(IInteractiveWindowProvider) private interactiveProvider: IInteractiveWindowProvider,
@inject(IConfigurationService) private configService: IConfigurationService,
@inject(INotebookProvider) private notebookProvider: INotebookProvider
@inject(INotebookProvider) private notebookProvider: INotebookProvider,
@inject(IWorkspaceService) private readonly workspace: IWorkspaceService
) {
this.notebookEditorProvider.onDidOpenNotebookEditor(this.onDidOpenNotebook.bind(this));
this.interactiveProvider.onDidChangeActiveInteractiveWindow(this.onDidOpenOrCloseInteractive.bind(this));
Expand Down Expand Up @@ -55,6 +57,9 @@ export class ServerPreload implements IExtensionSingleActivationService {
}

private async createServerIfNecessary() {
if (!this.workspace.isTrusted) {
return;
}
try {
traceInfo(`Attempting to start a server because of preload conditions ...`);

Expand Down