Skip to content

Basic auth flow #26

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

Closed
wants to merge 29 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
6a0ea07
Set mime to markdown when changing to markdown language mode (#129853)
mjbvz Jul 30, 2021
ba0df88
Update opacity on hover on top insert toolbar (#129863)
rebornix Jul 30, 2021
bc77f8d
Makes eslint-plugin-header a dev-dependency.
hediet Aug 2, 2021
ddfe10e
Merge pull request #129955 from microsoft/hediet/eslint-plugin-header…
hediet Aug 2, 2021
ebb5862
Ran OSS tool again, bump distro (#129990)
rzhao271 Aug 2, 2021
7982bc0
Instantiate language detection once (#129983)
TylerLeonhardt Aug 2, 2021
4101265
Bump telemetry package (#129995)
lramos15 Aug 2, 2021
ff43f8b
workbench.action.tasks.build no longer triggers build but opens a lis…
alexr00 Aug 3, 2021
cead2f6
Task spinner not showing in the status bar (#130050)
alexr00 Aug 3, 2021
8f58c1f
Set context key on more than just the working tree (#130061)
lramos15 Aug 3, 2021
deb07b8
Reverting #125570 (#130130)
digitarald Aug 4, 2021
379476f
Hide non-functional walkthroughs in virtual workspaces
digitarald Aug 4, 2021
9001270
code web server initial commit
akosyakov Aug 6, 2021
d3f9bdc
Added remote terminal channel handler
spoenemann Aug 10, 2021
5c9fe49
Add startup scripts
filiptronicek Aug 30, 2021
0791930
Use absolute paths in the startup script
filiptronicek Sep 2, 2021
676c1c3
initial draft of readme for web-server branch
svenefftinge Sep 2, 2021
a5a1397
Update README.md
svenefftinge Sep 3, 2021
50aa42f
Update README.md
svenefftinge Sep 3, 2021
5fba428
Update README.md
svenefftinge Sep 3, 2021
ede6f56
Update README.md
svenefftinge Sep 3, 2021
124c7dd
Update README.md
svenefftinge Sep 3, 2021
fc7b371
package startup scripts and latest node 14
akosyakov Sep 3, 2021
3e45b09
Smoke test running
jeanp413 Aug 27, 2021
b75d4b2
Add explorer and terminal smoke tests
jeanp413 Sep 1, 2021
9e8b013
Address Feedback
jeanp413 Sep 2, 2021
8b6e403
Add web worker extension test
jeanp413 Sep 4, 2021
8e0cd66
Add server-cli smoke test
jeanp413 Sep 4, 2021
b3890fe
Implement basic authentification
msujew Sep 2, 2021
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
24 changes: 13 additions & 11 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -789,6 +789,18 @@
"**/vs/workbench/workbench.web.api"
]
},
{
"target": "**/vs/server/browser/**",
"restrictions": [
"vs/nls",
"vs/css!./**/*",
"**/vs/base/**/{common,browser}/**",
"**/vs/base/parts/**/{common,browser}/**",
"**/vs/platform/**/{common,browser}/**",
"**/vs/code/**/{common,browser}/**",
"**/vs/workbench/workbench.web.api"
]
},
{
"target": "**/vs/code/node/**",
"restrictions": [
Expand Down Expand Up @@ -824,7 +836,7 @@
]
},
{
"target": "**/vs/server/**",
"target": "**/vs/server/node/**",
"restrictions": [
"vs/nls",
"**/vs/base/**/{common,node}/**",
Expand Down Expand Up @@ -981,16 +993,6 @@
"xterm*"
]
}
],
"header/header": [
2,
"block",
[
"---------------------------------------------------------------------------------------------",
" * Copyright (c) Microsoft Corporation. All rights reserved.",
" * Licensed under the MIT License. See License.txt in the project root for license information.",
" *--------------------------------------------------------------------------------------------"
]
]
},
"overrides": [
Expand Down
4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.DS_Store
*.DS_Store
.cache
npm-debug.log
Thumbs.db
Expand All @@ -7,8 +7,6 @@ node_modules/
extensions/**/dist/
/out*/
/extensions/**/out/
src/vs/server
resources/server
build/node_modules
coverage/
test_data/
Expand Down
57 changes: 57 additions & 0 deletions .gitpod.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
FROM gitpod/workspace-full:latest

USER root

# leeway
ENV LEEWAY_NESTED_WORKSPACE=true
RUN cd /usr/bin && curl -fsSL https://github.com/gitpod-io/leeway/releases/download/v0.2.5/leeway_0.2.5_Linux_x86_64.tar.gz | tar xz

USER gitpod

# We use latest major version of Node.js distributed VS Code. (see about dialog in your local VS Code)
RUN bash -c ". .nvm/nvm.sh \
&& nvm install 14 \
&& nvm use 14 \
&& nvm alias default 14"

RUN echo "nvm use default &>/dev/null" >> ~/.bashrc.d/51-nvm-fix

# Install dependencies
RUN sudo apt-get update \
&& sudo apt-get install -y --no-install-recommends \
xvfb x11vnc fluxbox dbus-x11 x11-utils x11-xserver-utils xdg-utils \
fbautostart xterm eterm gnome-terminal gnome-keyring seahorse nautilus \
libx11-dev libxkbfile-dev libsecret-1-dev libnotify4 libnss3 libxss1 \
libasound2 libgbm1 xfonts-base xfonts-terminus fonts-noto fonts-wqy-microhei \
fonts-droid-fallback vim-tiny nano libgconf2-dev libgtk-3-dev twm \
&& sudo apt-get clean && sudo rm -rf /var/cache/apt/* && sudo rm -rf /var/lib/apt/lists/* && sudo rm -rf /tmp/*

## Register leeway autocompletion in bashrc
RUN bash -c "echo . \<\(leeway bash-completion\) >> ~/.bashrc"

### Google Cloud ###
# not installed via repository as then 'docker-credential-gcr' is not available
ARG GCS_DIR=/opt/google-cloud-sdk
ENV PATH=$GCS_DIR/bin:$PATH
RUN sudo chown gitpod: /opt \
&& mkdir $GCS_DIR \
&& curl -fsSL https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-344.0.0-linux-x86_64.tar.gz \
| tar -xzvC /opt \
&& /opt/google-cloud-sdk/install.sh --quiet --usage-reporting=false --bash-completion=true \
--additional-components docker-credential-gcr alpha beta \
# needed for access to our private registries
&& docker-credential-gcr configure-docker

# Install tools for gsutil
RUN sudo install-packages \
gcc \
python-dev \
python-setuptools

RUN bash -c "pip uninstall crcmod; pip install --no-cache-dir -U crcmod"

# Set Application Default Credentials (ADC) based on user-provided env var
RUN echo ". /workspace/vscode/scripts/setup-google-adc.sh" >> ~/.bashrc

ENV LEEWAY_WORKSPACE_ROOT=/workspace/vscode
ENV LEEWAY_REMOTE_CACHE_BUCKET=gitpod-core-leeway-cache-branch
29 changes: 29 additions & 0 deletions .gitpod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
image:
file: .gitpod.Dockerfile
ports:
- port: 3000
onOpen: open-browser
tasks:
- init: |
export VSCODE_INIT_BUILD_DIR=$(leeway describe "//:init" -t "/tmp/build/{{ .Metadata.Name }}.{{ .Metadata.Version }}")
leeway build
sudo cp -rup "$VSCODE_INIT_BUILD_DIR/install/." . | true
command: |
gp sync-done init
export NODE_ENV=development
export VSCODE_DEV=1
yarn gulp watch-init
name: watch app
- command: |
export NODE_ENV=development
export VSCODE_DEV=1
gp sync-await init
node out/server.js
name: run app
openMode: split-right
github:
prebuilds:
pullRequestsFromForks: true
vscode:
extensions:
- dbaeumer.vscode-eslint
4 changes: 4 additions & 0 deletions .leewayignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/node_modules/
/out/
/.build/
/.git/
15 changes: 15 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
{
"version": "0.1.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Code Server",
"args": [
"${workspaceFolder}/out/server.js"
],
"outFiles": [
"${workspaceFolder}/out/**/*.js"
],
"env": {
"NODE_ENV": "development",
"VSCODE_DEV": "1"
}
},
{
"type": "node",
"request": "launch",
Expand Down
17 changes: 17 additions & 0 deletions BUILD.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
packages:
- name: install
type: generic
srcs:
- "**"
config:
commands:
- ["yarn"]
- name: init
type: generic
deps:
- ":install"
config:
commands:
- ["yarn", "--cwd", "./install/build", "compile"]
- ["yarn", "--cwd", "./install", "compile"]
- ["yarn", "--cwd", "./install", "download-builtin-extensions"]
78 changes: 16 additions & 62 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,75 +1,29 @@
# Visual Studio Code - Open Source ("Code - OSS")
[![Feature Requests](https://img.shields.io/github/issues/microsoft/vscode/feature-request.svg)](https://github.com/microsoft/vscode/issues?q=is%3Aopen+is%3Aissue+label%3Afeature-request+sort%3Areactions-%2B1-desc)
[![Bugs](https://img.shields.io/github/issues/microsoft/vscode/bug.svg)](https://github.com/microsoft/vscode/issues?utf8=✓&q=is%3Aissue+is%3Aopen+label%3Abug)
[![Gitter](https://img.shields.io/badge/chat-on%20gitter-yellow.svg)](https://gitter.im/Microsoft/vscode)
# VS Code Web Server

## The Repository
[![Gitpod ready-to-code](https://img.shields.io/badge/Gitpod-ready--to--code-908a85?logo=gitpod)](https://gitpod.io/from-referrer/)

This repository ("`Code - OSS`") is where we (Microsoft) develop the [Visual Studio Code](https://code.visualstudio.com) product together with the community. Not only do we work on code and issues here, we also publish our [roadmap](https://github.com/microsoft/vscode/wiki/Roadmap), [monthly iteration plans](https://github.com/microsoft/vscode/wiki/Iteration-Plans), and our [endgame plans](https://github.com/microsoft/vscode/wiki/Running-the-Endgame). This source code is available to everyone under the standard [MIT license](https://github.com/microsoft/vscode/blob/main/LICENSE.txt).
## What is this?

## Visual Studio Code
This project provides a version of VS Code that runs a server on a remote machine and allows through a modern web browser. It's based on the very same architecture used by [Gitpod](https://www.gitpod.io) or [GitHub Codespaces](https://github.com).

<p align="center">
<img alt="VS Code in action" src="https://user-images.githubusercontent.com/35271042/118224532-3842c400-b438-11eb-923d-a5f66fa6785a.png">
</p>
<img width="1624" alt="Screenshot 2021-09-02 at 08 39 26" src="https://user-images.githubusercontent.com/372735/131794918-d6602646-4d67-435b-88fe-620a3cc0a3aa.png">

[Visual Studio Code](https://code.visualstudio.com) is a distribution of the `Code - OSS` repository with Microsoft specific customizations released under a traditional [Microsoft product license](https://code.visualstudio.com/License/).
## Why?

[Visual Studio Code](https://code.visualstudio.com) combines the simplicity of a code editor with what developers need for their core edit-build-debug cycle. It provides comprehensive code editing, navigation, and understanding support along with lightweight debugging, a rich extensibility model, and lightweight integration with existing tools.
VS Code has traditionally been a desktop IDE built with web technology. A few years back people started patching it, in order to run it in a remote context and to make it accessible through web browsers. [These efforts have been complex and error prone](https://github.com/cdr/code-server/issues/3835), because many changes had to be made across the large code base of VS Code.

Visual Studio Code is updated monthly with new features and bug fixes. You can download it for Windows, macOS, and Linux on [Visual Studio Code's website](https://code.visualstudio.com/Download). To get the latest releases every day, install the [Insiders build](https://code.visualstudio.com/insiders).
Luckily in 2019 the VS Code team started to refactor its architecture to support this working mode. While this new architecture has been adopted by Gitpod and GitHub, the important bits have not been open-sources, yet. As a result many people in the community are still using the old hard to maintain and error-prone approach.

## Contributing
At Gitpod we've been asked a lot about how we do it. So we thought we might just share the minimal set of changes needed, so people can rely on the latest version of VS Code and have a straightforward upgrade path and low maintenance effort.

There are many ways in which you can participate in this project, for example:
## Getting started

* [Submit bugs and feature requests](https://github.com/microsoft/vscode/issues), and help us verify as they are checked in
* Review [source code changes](https://github.com/microsoft/vscode/pulls)
* Review the [documentation](https://github.com/microsoft/vscode-docs) and make pull requests for anything from typos to additional and new content
The easiest way to get started is ...

If you are interested in fixing issues and contributing directly to the code base,
please see the document [How to Contribute](https://github.com/microsoft/vscode/wiki/How-to-Contribute), which covers the following:
## The scope of this project

* [How to build and run from source](https://github.com/microsoft/vscode/wiki/How-to-Contribute)
* [The development workflow, including debugging and running tests](https://github.com/microsoft/vscode/wiki/How-to-Contribute#debugging)
* [Coding guidelines](https://github.com/microsoft/vscode/wiki/Coding-Guidelines)
* [Submitting pull requests](https://github.com/microsoft/vscode/wiki/How-to-Contribute#pull-requests)
* [Finding an issue to work on](https://github.com/microsoft/vscode/wiki/How-to-Contribute#where-to-contribute)
* [Contributing to translations](https://aka.ms/vscodeloc)
This project really only adds the minimal bits required to run VS Code in a web server scenario. We have no intention of changing VS Code in any way or adding additional features through this. Feature requests, bug fixes, etc. should go to the upstream repository.

## Feedback

* Ask a question on [Stack Overflow](https://stackoverflow.com/questions/tagged/vscode)
* [Request a new feature](CONTRIBUTING.md)
* Upvote [popular feature requests](https://github.com/microsoft/vscode/issues?q=is%3Aopen+is%3Aissue+label%3Afeature-request+sort%3Areactions-%2B1-desc)
* [File an issue](https://github.com/microsoft/vscode/issues)
* Follow [@code](https://twitter.com/code) and let us know what you think!

See our [wiki](https://github.com/microsoft/vscode/wiki/Feedback-Channels) for a description of each of these channels and information on some other available community-driven channels.

## Related Projects

Many of the core components and extensions to VS Code live in their own repositories on GitHub. For example, the [node debug adapter](https://github.com/microsoft/vscode-node-debug) and the [mono debug adapter](https://github.com/microsoft/vscode-mono-debug) have their own repositories. For a complete list, please visit the [Related Projects](https://github.com/microsoft/vscode/wiki/Related-Projects) page on our [wiki](https://github.com/microsoft/vscode/wiki).

## Bundled Extensions

VS Code includes a set of built-in extensions located in the [extensions](extensions) folder, including grammars and snippets for many languages. Extensions that provide rich language support (code completion, Go to Definition) for a language have the suffix `language-features`. For example, the `json` extension provides coloring for `JSON` and the `json-language-features` provides rich language support for `JSON`.

## Development Container

This repository includes a Visual Studio Code Remote - Containers / GitHub Codespaces development container.

- For [Remote - Containers](https://aka.ms/vscode-remote/download/containers), use the **Remote-Containers: Clone Repository in Container Volume...** command which creates a Docker volume for better disk I/O on macOS and Windows.
- For Codespaces, install the [Github Codespaces](https://marketplace.visualstudio.com/items?itemName=GitHub.codespaces) extension in VS Code, and use the **Codespaces: Create New Codespace** command.

Docker / the Codespace should have at least **4 Cores and 6 GB of RAM (8 GB recommended)** to run full build. See the [development container README](.devcontainer/README.md) for more information.

## Code of Conduct

This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [[email protected]](mailto:[email protected]) with any additional questions or comments.

## License

Copyright (c) Microsoft Corporation. All rights reserved.

Licensed under the [MIT](LICENSE.txt) license.
> **For any feature requests, bug reports, or contributions that are not specific to running VS Code in a web server context,**
>
> **please go to [Visual Studio Code - Open Source "OSS"](https://github.com/microsoft/vscode)**
1 change: 1 addition & 0 deletions WORKSPACE.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
defaultTarget: "//:init"
17 changes: 17 additions & 0 deletions build/azure-pipelines/common/sign-win32.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
"use strict";
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
Object.defineProperty(exports, "__esModule", { value: true });
const sign_1 = require("./sign");
const path = require("path");
(0, sign_1.main)([
process.env['EsrpCliDllPath'],
'windows',
process.env['ESRPPKI'],
process.env['ESRPAADUsername'],
process.env['ESRPAADPassword'],
path.dirname(process.argv[2]),
path.basename(process.argv[2])
]);
77 changes: 77 additions & 0 deletions build/azure-pipelines/common/sign.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
"use strict";
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.main = void 0;
const cp = require("child_process");
const fs = require("fs");
const tmp = require("tmp");
const crypto = require("crypto");
function getParams(type) {
switch (type) {
case 'windows':
return '[{"keyCode":"CP-230012","operationSetCode":"SigntoolSign","parameters":[{"parameterName":"OpusName","parameterValue":"VS Code"},{"parameterName":"OpusInfo","parameterValue":"https://code.visualstudio.com/"},{"parameterName":"Append","parameterValue":"/as"},{"parameterName":"FileDigest","parameterValue":"/fd \\"SHA256\\""},{"parameterName":"PageHash","parameterValue":"/NPH"},{"parameterName":"TimeStamp","parameterValue":"/tr \\"http://rfc3161.gtm.corp.microsoft.com/TSS/HttpTspServer\\" /td sha256"}],"toolName":"sign","toolVersion":"1.0"},{"keyCode":"CP-230012","operationSetCode":"SigntoolVerify","parameters":[{"parameterName":"VerifyAll","parameterValue":"/all"}],"toolName":"sign","toolVersion":"1.0"}]';
case 'rpm':
return '[{ "keyCode": "CP-450779-Pgp", "operationSetCode": "LinuxSign", "parameters": [], "toolName": "sign", "toolVersion": "1.0" }]';
case 'darwin-sign':
return '[{"keyCode":"CP-401337-Apple","operationSetCode":"MacAppDeveloperSign","parameters":[{"parameterName":"Hardening","parameterValue":"--options=runtime"}],"toolName":"sign","toolVersion":"1.0"}]';
case 'darwin-notarize':
return '[{"keyCode":"CP-401337-Apple","operationSetCode":"MacAppNotarize","parameters":[{"parameterName":"BundleId","parameterValue":"$(BundleIdentifier)"}],"toolName":"sign","toolVersion":"1.0"}]';
default:
throw new Error(`Sign type ${type} not found`);
}
}
function main([esrpCliPath, type, cert, username, password, folderPath, pattern]) {
tmp.setGracefulCleanup();
const patternPath = tmp.tmpNameSync();
fs.writeFileSync(patternPath, pattern);
const paramsPath = tmp.tmpNameSync();
fs.writeFileSync(paramsPath, getParams(type));
const keyFile = tmp.tmpNameSync();
const key = crypto.randomBytes(32);
const iv = crypto.randomBytes(16);
fs.writeFileSync(keyFile, JSON.stringify({ key: key.toString('hex'), iv: iv.toString('hex') }));
const clientkeyPath = tmp.tmpNameSync();
const clientkeyCypher = crypto.createCipheriv('aes-256-cbc', key, iv);
let clientkey = clientkeyCypher.update(password, 'utf8', 'hex');
clientkey += clientkeyCypher.final('hex');
fs.writeFileSync(clientkeyPath, clientkey);
const clientcertPath = tmp.tmpNameSync();
const clientcertCypher = crypto.createCipheriv('aes-256-cbc', key, iv);
let clientcert = clientcertCypher.update(cert, 'utf8', 'hex');
clientcert += clientcertCypher.final('hex');
fs.writeFileSync(clientcertPath, clientcert);
const args = [
esrpCliPath,
'vsts.sign',
'-a', username,
'-k', clientkeyPath,
'-z', clientcertPath,
'-f', folderPath,
'-p', patternPath,
'-u', 'false',
'-x', 'regularSigning',
'-b', 'input.json',
'-l', 'AzSecPack_PublisherPolicyProd.xml',
'-y', 'inlineSignParams',
'-j', paramsPath,
'-c', '9997',
'-t', '120',
'-g', '10',
'-v', 'Tls12',
'-s', 'https://api.esrp.microsoft.com/api/v1',
'-m', '0',
'-o', 'Microsoft',
'-i', 'https://www.microsoft.com',
'-n', '5',
'-r', 'true',
'-e', keyFile,
];
cp.spawnSync('dotnet', args, { stdio: 'inherit' });
}
exports.main = main;
if (require.main === module) {
main(process.argv.slice(2));
}
4 changes: 3 additions & 1 deletion build/gulpfile.extensions.js
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,9 @@ const compileExtensionsBuildTask = task.define('compile-extensions-build', task.
));

gulp.task(compileExtensionsBuildTask);
gulp.task(task.define('extensions-ci', task.series(compileExtensionsBuildTask, compileExtensionMediaBuildTask)));
const compileExtensionsCi = task.series(compileExtensionsBuildTask, compileExtensionMediaBuildTask);
gulp.task(task.define('extensions-ci', compileExtensionsCi));
exports.compileExtensionsCi = compileExtensionsCi;

exports.compileExtensionsBuildTask = compileExtensionsBuildTask;

Expand Down
Loading