Commit Graph

258 Commits

Author SHA1 Message Date
Tyler James Leonhardt
9ca1204521 Doc calling out GitHub OAuth client secret behavior (#242210) 2025-02-27 18:47:41 +01:00
Tyler James Leonhardt
d5f4a77e00 GitHub Enterprise GHE.com Setting clarity (#240289)
And a pattern to make sure no one puts a DotCom URL.

ref https://github.com/microsoft/vscode-pull-request-github/issues/6602
2025-02-10 20:35:06 +01:00
Devraj Mehta
63d1401dee fix: add electron as an external for webpack (#239134)
* fix: add electron as an external for webpack

* refactor: move electron external to shared webpack
2025-02-03 18:54:18 +00:00
Devraj Mehta
87ed97df8b Use Electron fetch or Node fetch for github-authentication to support proxies (#238149)
* Attempt to use Electron fetch for github-authentication

Also changes fallback from node-fetch to the built-in Node fetch

* Remove Content-Length header Electron compatibility

It looks like it was set incorrectly to the body contents anyways.
2025-01-17 19:05:10 +00:00
Logan Ramos
e689b912ba Update telemetry package (#236378) 2024-12-17 20:12:49 +01:00
Tyler James Leonhardt
950b401a9c Make multiple accounts the default (#231618) 2024-10-18 01:36:06 +02:00
Tyler James Leonhardt
6d482e38cd No longer look at sessions[0] (#231063)
We don't need to do this anymore now that account preference is kept across sessions.
2024-10-10 14:50:19 -07:00
Robo
9494a89080 chore: add npmrc to extensions folder (#230214) 2024-10-01 12:43:01 +02:00
Tyler James Leonhardt
52b0ec07b8 Allow Multi-account in GitHub Auth in Insiders (#229106) 2024-09-20 00:31:40 +02:00
Tyler James Leonhardt
c4d1cc2e67 Fix GitHub account ids being numbers (#228045)
For a long time the account id wasn't handled correctly. It should be a string, but the API returns a number. This ensures it's a string and does some migration logic.
2024-09-10 04:39:37 +02:00
hj
88d7b97c93 chore: rm unreached ignore items when build extensions. (#227906)
chore: rm unreached ignore items when compiling extensions.
2024-09-09 10:32:51 +00:00
Robo
b5a6aa14a8 feat: switch to npm as default package manager (#226927)
* feat: move from yarn to npm

* chore: skip yarn.lock files

* fix: playwright download

* chore: fix compile and hygiene

* chore: bump vsce@2.17.0

Refs 8b49e9dfdf

* test: update results for bat and sh colorizer tests

* fix: add missing lock files for windows

* fix: switch to legacy-peer-deps

* chore: update markdown-it@14.1.0

Refs 737c95a129

esbuild step in extensions-ci-pr was previously using markdown-it
from root which had userland punycode and was able to compile successfully.

* ci: increase pr timeout for windows integration tests

* chore: fix product build

* build: ignore extension dev dependency for rcedit

* build: fix working directory inside container

* build: fix dependency generation

* npm: update dependencies

* ci: use global npmrc

* ci: update cache

* ci: setup global npmrc for private npm auth

* build: fix extension bundling

* chore: sync npm dependencies

* ci: debug env variables for container

* ci: fix win32 cli pipeline

* build: fix npmrc config usage for build/ and remote/ dirs

* fix: windows build

* fix: container builds

* fix: markdown-language-features tests and bundling

```
[03:58:22] Error: Command failed: /Users/demohan/.nvm/versions/node/v20.15.1/bin/node /Users/demohan/github/vscode/extensions/markdown-language-features/esbuild-notebook.js --outputRoot /Users/demohan/github/vscode/.build/extensions/markdown-language-features
✘ [ERROR] Could not resolve "punycode"

    extensions/markdown-language-features/node_modules/markdown-it/lib/index.js:14:27:
      14 │ var punycode     = require('punycode');
         ╵                            ~~~~~~~~~~

  The package "punycode" wasn't found on the file system but is built into node. Are you trying to bundle for node? You can use "platform: 'node'" to do that, which will remove this error.
```

Adds userland package based on beed9aee2c

* fix: container builds for distro

* chore: update yarn occurrences

* fixup! chore: bump vsce@2.17.0

Uses the closest version to `main` branch that does not
include d3cc84cdec
while still having the fix 8b49e9dfdf

* chore: sync npm dependencies

* chore: sync npm dependencies

* chore: sync npm dependencies

* chore: throw error when yarn is used for installation

* chore: add review feedback

* chore: switch exec => run where needed

* chore: npm sync dependencies

* fix: markdown-language-features bundling

```
✘ [ERROR] Could not resolve "punycode"

    extensions/markdown-language-features/node_modules/markdown-it/lib/index.js:14:27:
      14 │ var punycode     = require('punycode');
         ╵                            ~~~~~~~~~~

  The package "punycode" wasn't found on the file system but is built into node. Are you trying to bundle for node? You can use "platform: 'node'" to do that, which will remove this error.
```

Adds missing userland package based on markdown-it/markdown-it@beed9ae,
can be removed once we update markdown-it >= 14.1.0

* ci: rename no-yarn-lock-changes.yml

* chore: sync npm dependencies

* ci: restore no-yarn-lock-changes.yml

We can disable it in a separate PR to keep the required
checks happy and also need workflow edit perms.

* chore: sync npm dependencies

* ci: rebuild cache

* ci: fix no-package-lock-changes.yml

* chore: bump distro

* chore: rm yarn.lock files

* chore: rm yarn.lock files without dependencies

* chore: add vscode-selfhost-import-aid to postinstall dirs

* chore: bump distro
2024-09-06 22:18:02 +09:00
Tyler James Leonhardt
04bcb01ddf Move 'incorrect account' handling into core (#224872)
So that all auth providers can take advantage of this logic. This basically will do a light enforcement that the account you signed in to matches the account that was requested (if it was specified).

This is needed for finalization.
2024-08-05 12:45:11 -07:00
Tyler James Leonhardt
02b638ae27 Finalize getAccounts API (#224877)
Fixes https://github.com/microsoft/vscode/issues/152399
2024-08-05 11:59:33 -07:00
Matt Bierner
84607a2fe2 Fix some always true/false errors in codebase (#223359)
* Fix some always true/false errors in codebase

Testing out latest TS nightly that can identify when an expression is always true/false. This caught a few likely coding mistakes in our codebase

Unsure about the intent in some of these cases but I've tried my best to understand them. Pinging relevant code owners for the confusing cases

* Bump TS version

* Fix unreachable in build scripts

* Bump versions

* restore intent

* Revert package.json change

* Fixing a few new layer checker errors

These are global in node now

* Skip lib check in integration project

* One more skiplibcheck

* More skip lib

---------

Co-authored-by: Benjamin Pasero <benjamin.pasero@gmail.com>
2024-07-30 15:37:27 -07:00
Tyler James Leonhardt
3873c58c47 If the setting value is the same, do nothing (#223518)
It seems like this event fires in Codespaces... my _guess_ is that Codespaces basically overwrites all the settings from settings sync which causes this event to fire.

It's surprising to me that this event fires even though the value hasn't changed.

I can't repro this with the test resolver, and I also cant have Codespaces use Code - OSS, so we'll just have to see how this goes.

This _should_ do the trick though.

Fixes https://github.com/microsoft/vscode/issues/223508
2024-07-24 10:11:27 -07:00
Tyler James Leonhardt
ba98397575 Experimental GitHub Multi-account support (#222131)
* Have select account picker include accounts that don't match requested scopes (this will run `createSession` for that chosen account)
* Implement multi-account GitHub support behind a setting
2024-07-19 14:48:40 -07:00
Tyler James Leonhardt
1b24381b5c Adopt getAccounts API in GitHub Authentication (#221224)
This allows the GitHub Auth provider to take in a account per this proposal:

417dddb83f/src/vscode-dts/vscode.proposed.authGetSessions.d.ts (L35-L69)

Additionally, this makes an additional small change that allows `clearSessionPreference` to work in single-account auth providers.
2024-07-09 00:19:40 +02:00
Tyler James Leonhardt
9d4274e559 Remove session if it is being replaced (#212504)
A bug that has probably existed for quite a while... if we are replacing a session, we should say the old session is removed.
2024-05-11 14:49:03 +02:00
Robo
5216c04428 chore: update to electron 29 (#209818)
* chore: update electron@29.1.0

* chore: update typings to 20.x

* chore: bump electron@29.1.5

* ci: fix crash in compiling extensions-ci

* chore: disable .d.ts check for build/

$ ../node_modules/.bin/tsc -p tsconfig.build.json
node_modules/@types/chokidar/index.d.ts:21:14 - error TS2420: Class 'import("/Users/demohan/github/vscode/build/node_modules/@types/chokidar/index").FSWatcher' incorrectly implements interface 'import("fs").FSWatcher'.
  Type 'FSWatcher' is missing the following properties from type 'FSWatcher': ref, unref

21 export class FSWatcher extends EventEmitter implements fs.FSWatcher {
                ~~~~~~~~~

node_modules/chokidar/types/index.d.ts:8:14 - error TS2420: Class 'import("/Users/demohan/github/vscode/build/node_modules/chokidar/types/index").FSWatcher' incorrectly implements interface 'import("fs").FSWatcher'.
  Type 'FSWatcher' is missing the following properties from type 'FSWatcher': ref, unref

8 export class FSWatcher extends EventEmitter implements fs.FSWatcher {
               ~~~~~~~~~

Found 2 errors in 2 files.

Errors  Files
     1  node_modules/@types/chokidar/index.d.ts:21
     1  node_modules/chokidar/types/index.d.ts:8

Refs a0f9e09f64

* chore: update core types

* temp: fix layer validation

* chore: update nodejs checksums

* ci: use latest v20 LTS for missing node-gyp

Refs eacec5f490

* ci: define LIBCPP_HARDENING_MODE

* ci: fix crash in vscode-web-min-ci

* chore: update rpm deps-list

* chore: bump tree-sitter-typescript@0.20.5

* chore: bump electron@29.3.0

* chore: bump electron@29.3.1

* chore: update rpm deps-list for x86_64

* ci: disable io_uring UV backend on linux

* ci: disable io_uring backend for oss as well

* chore: update typings to 20.x

* ci: add TODO for io_uring workaround

* chore: bump distro

* chore: update preinstall node version checks

* chore: update @types/gulp

Refs https://github.com/microsoft/vscode/issues/212442

* ci: disable io_uring in more test suites
2024-05-11 01:20:28 +09:00
Tyler James Leonhardt
dc45ddef95 Remove requirement that there can be only one account (#212398)
This allows each set of scopes to have one account associated with it.
2024-05-09 15:59:58 -07:00
Tyler James Leonhardt
cd6bd0a01a Bug fix: check account id not session id (#206990)
This should be checking the account id not the session id... otherwise the user will get a modal every time they go through the login flow.
2024-03-06 19:02:46 +01:00
Tyler James Leonhardt
191be39e5a Make sure the same GitHub account is used until we support multiple GH accounts (#206847)
Fixes https://github.com/microsoft/vscode/issues/203850
2024-03-04 15:01:51 -08:00
Logan Ramos
436af204d4 Bump tas client (#206106) 2024-02-23 10:00:23 -08:00
dependabot[bot]
9c2e81f9f6 Bump follow-redirects from 1.15.3 to 1.15.4 in /extensions/github-authentication (#202055)
Bump follow-redirects in /extensions/github-authentication

Bumps [follow-redirects](https://github.com/follow-redirects/follow-redirects) from 1.15.3 to 1.15.4.
- [Release notes](https://github.com/follow-redirects/follow-redirects/releases)
- [Commits](https://github.com/follow-redirects/follow-redirects/compare/v1.15.3...v1.15.4)

---
updated-dependencies:
- dependency-name: follow-redirects
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-09 08:53:01 -08:00
Raymond Zhao
e1c8870cd2 chore: bump vscode-tas-client (#198257) 2023-11-15 00:12:17 +01:00
Logan Ramos
9bea1fc96a Bump telemetry package (#197168) 2023-11-01 20:51:03 +01:00
Tyler James Leonhardt
482d5ba393 Add some integration tests for github-auth (#195729) 2023-10-16 13:58:44 -07:00
Logan Ramos
cc98e55794 Fix slow telemetry module (#193607) 2023-09-20 20:14:12 +01:00
Tyler James Leonhardt
5134662139 Remove CredentialsService & keytar (#192224)
* Remove CredentialsService & keytar

ref https://github.com/microsoft/vscode/issues/115215
fixes https://github.com/microsoft/vscode/issues/143395

* compile

* remove imports

* rip the bandaid
2023-09-05 17:47:30 -07:00
Tyler James Leonhardt
eec2fc723c Disable Local Server flow for REH (#191930)
Because spinning up ports on the remote won't always work. Instead, we have the trusty device code flow.

Fixes https://github.com/microsoft/vscode/issues/191866
Fixes https://github.com/microsoft/vscode/issues/191867
2023-08-31 22:10:26 +02:00
Logan Ramos
ecb0c80fc1 Bump extension telemetry module (#191237)
* Bump extension telemetry module

* Fix webpack
2023-08-24 12:53:41 -07:00
Robo
ea490e5545 chore: update to Electron 25 (#188268)
* chore: update electron@25.3.0

* ci: update NodeTool version

* chore: update @types/node

* add more common types to layers checker

* chore: update debian dependencies

* chore: update rpm dependencies

* fix: use legacy dns result order of Node.js

* ci: remove deprecated always-auth npm config

Refs npm/cli@72a7eeb

* chore: update deb and rpm dependencies

* chore: update armhf rpm dependencies

* chore: update x64 debian dependencies

* chore: update x64 rpm dependencies

* chore: update electron@25.3.1

* chore: update electron@25.4.0

* chore: bump distro

* chore: bump distro

---------

Co-authored-by: Benjamin Pasero <benjamin.pasero@microsoft.com>
2023-08-07 21:46:27 +09:00
Tyler Leonhardt
ac27273e48 Try to revoke tokens that are getting deleted
Best effort.

Fixes https://github.com/microsoft/vscode/issues/152055
2023-07-17 14:12:10 -07:00
Raymond Zhao
5be539a588 Bump semver (#187654) 2023-07-12 01:49:45 +02:00
Tyler James Leonhardt
013132a5cd Re-work auth flows into separate file (#186939)
The flows are crucial to the extension and I wanted to be able to declare which can be used when in a declarative way. This reworks the flows into that model.

Additionally, it pulls in the Client ID and secret from a config which will allow us to not rely on the vscode.dev proxy on Desktop (because we can make a distro change that includes the secret... which isn't a real secret, says GitHub)... unfortunately we still need to rely on it for Web due to CORS but we're in a position where it will be easy to rip the proxy out when GH supports it.
2023-07-03 15:06:42 -07:00
Tyler James Leonhardt
f9b4b4c6a3 Pass session down so we can avoid a network call (#181570)
We don't need to fetch the user details when the Auth Session already has the info we need. This PR removes that extraneous web request.

I've also changed the `User-Agent` that we pass to be more specific so we can narrow down any future issues with spamming web requests.

Fixes #173645
2023-05-04 11:59:25 -07:00
Tyler James Leonhardt
738ab7954c Add mode to the notification (#180977)
ref https://github.com/microsoft/vscode/issues/180803#issuecomment-1522947472
2023-04-26 23:16:39 +02:00
Tyler James Leonhardt
1714f71c41 Organize Errors in GitHub Auth and make sure no double prompting happens (#180734)
* Organize Errors in GitHub Auth and make sure no double prompting happens

This mostly just moves some strings into variables... but this also fixes the GH Auth side of https://github.com/microsoft/vscode/issues/180697 so you should only be asked once if you want to try a different way to log in.

* add comments
2023-04-24 12:59:03 -07:00
Tyler James Leonhardt
99e4904905 Add annotation to a telemetry point (#175370)
* Add annotation to a telemetry point

* forgot ,
2023-02-24 19:13:55 +01:00
Logan Ramos
8e6bcc9b9e Bump module to new package (#173599) 2023-02-06 12:29:36 -08:00
Tyler James Leonhardt
57f26d2907 Fixes #173380 (#173428)
Fixes #173380
2023-02-04 15:57:24 +01:00
Tyler James Leonhardt
06eb374137 Improve GHES flow (#172959)
* Improve GHES flow

It's clear to me now that a lot of users of the GHES flow have auth behind a VPN. Something that we cannot support in the OAuth flow because we require making a request to vscode.dev who makes a request to the GHES instance.

In light of this, we will remove the OAuth flow for GHES. Fear not, though... because both the Device Code Flow and the PAT flow are there and the PAT flow has been improved in 1.75... so in conclusion, I think GHES is handled as best we can with this PR.

Additionally, there is some "Hosted GitHub Enterprise" scenarios popping up, and this future proofs that by allowing "Hosted GitHub Enterprise" experiences to go through the OAuth flow because we know for a fact that they will be accessible from vscode.dev.

Fixes #169619
Fixes https://github.com/microsoft/vscode-internalbacklog/issues/3398

* Use api. sub domain and update telemetry logic
2023-01-31 13:25:12 -08:00
Logan Ramos
8cea434dec Remove unused proposals (#172035) 2023-01-23 19:09:07 +01:00
Tyler James Leonhardt
656e526b3e Add EMU to session telemetry (#171186)
* Telemetry for EMU

* comment
2023-01-12 18:51:18 +01:00
Logan Ramos
4acf2d9b46 Update the telemetry modules (#170512)
Update the module
2023-01-03 15:10:45 -05:00
Tyler James Leonhardt
a790196c19 Improve PAT auth flow (#170239)
This improves the PAT auth flow by showing a modal to open github.com with the scopes already pre-filled.

This should allow for less room for error during the PAT auth.

Additionally, this allows PAT auth flow to be used as a fallback for GH Enterprise flows.
2022-12-29 20:28:57 +01:00
Logan Ramos
b1076b41f3 Bump telemetry packages (#169283) 2022-12-15 17:29:10 +01:00
Tyler James Leonhardt
342a1f4f52 Don't run the local server option if we are running in remote (#169076)
Additionally improve the conditional for device code flow.

ref #168338
2022-12-13 17:18:25 -08:00
Joyce Er
3bdea7784d authentication implicit activation events (#166715)
* `authentication` implicit activation events

* More safety accessing `.id`
2022-11-19 08:30:48 -08:00