Skip to content

Commit d1fed9e

Browse files
committed
wip: attempt to sign uninstaller
1 parent 91e82ed commit d1fed9e

8 files changed

Lines changed: 208 additions & 165 deletions

File tree

‎build/gulpfile.hygiene.js‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ const indentationFilter = [
8282
'!build/{lib,tslintRules}/**/*.js',
8383
'!build/**/*.sh',
8484
'!build/tfs/**/*.js',
85+
'!build/tfs/**/*.config',
8586
'!**/Dockerfile',
8687
'!extensions/markdown-language-features/media/*.js'
8788
];

‎build/gulpfile.vscode.win32.js‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,11 @@ function packageInnoSetup(iss, options, cb) {
4242
keys.forEach(key => assert(typeof definitions[key] === 'string', `Missing value for '${key}' in Inno Setup package step`));
4343

4444
const defs = keys.map(key => `/d${key}=${definitions[key]}`);
45-
const args = [iss].concat(defs);
45+
const args = [
46+
iss,
47+
'/Sesrp="powershell.exe build\tfs\win32\sign.ps1 $f"',
48+
...defs
49+
];
4650

4751
cp.spawn(innoSetupPath, args, { stdio: ['ignore', 'inherit', 'inherit'] })
4852
.on('error', cb)

‎build/tfs/product-build.yml‎

Lines changed: 102 additions & 164 deletions
Original file line numberDiff line numberDiff line change
@@ -39,177 +39,115 @@ phases:
3939
npm run gulp -- "vscode-win32-$(VSCODE_ARCH)-copy-inno-updater"
4040
name: build
4141
42-
- powershell: |
43-
$ErrorActionPreference = "Stop"
44-
npm run gulp -- "electron-$(VSCODE_ARCH)"
45-
.\scripts\test.bat --build --tfs "Unit Tests"
46-
# yarn smoketest -- --build "$(agent.builddirectory)\VSCode-win32-$(VSCODE_ARCH)"
47-
name: test
48-
49-
- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@1
42+
# - powershell: |
43+
# $ErrorActionPreference = "Stop"
44+
# npm run gulp -- "electron-$(VSCODE_ARCH)"
45+
# .\scripts\test.bat --build --tfs "Unit Tests"
46+
# # yarn smoketest -- --build "$(agent.builddirectory)\VSCode-win32-$(VSCODE_ARCH)"
47+
# name: test
48+
49+
# - task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@1
50+
# inputs:
51+
# ConnectedServiceName: 'ESRP CodeSign'
52+
# FolderPath: '$(agent.builddirectory)/VSCode-win32-$(VSCODE_ARCH)'
53+
# Pattern: '*.dll,*.exe,*.node'
54+
# signConfigType: inlineSignParams
55+
# inlineOperation: |
56+
# [
57+
# {
58+
# "keyCode": "CP-229803",
59+
# "operationSetCode": "SigntoolSign",
60+
# "parameters": [
61+
# {
62+
# "parameterName": "OpusName",
63+
# "parameterValue": "VS Code"
64+
# },
65+
# {
66+
# "parameterName": "OpusInfo",
67+
# "parameterValue": "https://code.visualstudio.com/"
68+
# },
69+
# {
70+
# "parameterName": "PageHash",
71+
# "parameterValue": "/NPH"
72+
# },
73+
# {
74+
# "parameterName": "TimeStamp",
75+
# "parameterValue": "/t \"http://ts4096.gtm.microsoft.com/TSS/AuthenticodeTS\""
76+
# }
77+
# ],
78+
# "toolName": "sign",
79+
# "toolVersion": "1.0"
80+
# },
81+
# {
82+
# "keyCode": "CP-230012",
83+
# "operationSetCode": "SigntoolSign",
84+
# "parameters": [
85+
# {
86+
# "parameterName": "OpusName",
87+
# "parameterValue": "VS Code"
88+
# },
89+
# {
90+
# "parameterName": "OpusInfo",
91+
# "parameterValue": "https://code.visualstudio.com/"
92+
# },
93+
# {
94+
# "parameterName": "Append",
95+
# "parameterValue": "/as"
96+
# },
97+
# {
98+
# "parameterName": "FileDigest",
99+
# "parameterValue": "/fd \"SHA256\""
100+
# },
101+
# {
102+
# "parameterName": "PageHash",
103+
# "parameterValue": "/NPH"
104+
# },
105+
# {
106+
# "parameterName": "TimeStamp",
107+
# "parameterValue": "/tr \"http://rfc3161.gtm.corp.microsoft.com/TSS/HttpTspServer\" /td sha256"
108+
# }
109+
# ],
110+
# "toolName": "sign",
111+
# "toolVersion": "1.0"
112+
# },
113+
# {
114+
# "keyCode": "CP-230012",
115+
# "operationSetCode": "SigntoolVerify",
116+
# "parameters": [
117+
# {
118+
# "parameterName": "VerifyAll",
119+
# "parameterValue": "/all"
120+
# }
121+
# ],
122+
# "toolName": "sign",
123+
# "toolVersion": "1.0"
124+
# }
125+
# ]
126+
# SessionTimeout: 120
127+
128+
- task: NuGetCommand@2
129+
displayName: Install ESRPClient.exe
130+
inputs:
131+
restoreSolution: 'build\tfs\win32\ESRPClient\packages.config'
132+
feedsToUse: config
133+
nugetConfigPath: 'build\tfs\win32\ESRPClient\NuGet.config'
134+
externalFeedCredentials:
135+
restoreDirectory: packages
136+
137+
- task: ESRPImportCertTask@1
138+
displayName: Import ESRP Request Signing Certificate
50139
inputs:
51-
ConnectedServiceName: 'ESRP CodeSign'
52-
FolderPath: '$(agent.builddirectory)/VSCode-win32-$(VSCODE_ARCH)'
53-
Pattern: '*.dll,*.exe,*.node'
54-
signConfigType: inlineSignParams
55-
inlineOperation: |
56-
[
57-
{
58-
"keyCode": "CP-229803",
59-
"operationSetCode": "SigntoolSign",
60-
"parameters": [
61-
{
62-
"parameterName": "OpusName",
63-
"parameterValue": "VS Code"
64-
},
65-
{
66-
"parameterName": "OpusInfo",
67-
"parameterValue": "https://code.visualstudio.com/"
68-
},
69-
{
70-
"parameterName": "PageHash",
71-
"parameterValue": "/NPH"
72-
},
73-
{
74-
"parameterName": "TimeStamp",
75-
"parameterValue": "/t \"http://ts4096.gtm.microsoft.com/TSS/AuthenticodeTS\""
76-
}
77-
],
78-
"toolName": "sign",
79-
"toolVersion": "1.0"
80-
},
81-
{
82-
"keyCode": "CP-230012",
83-
"operationSetCode": "SigntoolSign",
84-
"parameters": [
85-
{
86-
"parameterName": "OpusName",
87-
"parameterValue": "VS Code"
88-
},
89-
{
90-
"parameterName": "OpusInfo",
91-
"parameterValue": "https://code.visualstudio.com/"
92-
},
93-
{
94-
"parameterName": "Append",
95-
"parameterValue": "/as"
96-
},
97-
{
98-
"parameterName": "FileDigest",
99-
"parameterValue": "/fd \"SHA256\""
100-
},
101-
{
102-
"parameterName": "PageHash",
103-
"parameterValue": "/NPH"
104-
},
105-
{
106-
"parameterName": "TimeStamp",
107-
"parameterValue": "/tr \"http://rfc3161.gtm.corp.microsoft.com/TSS/HttpTspServer\" /td sha256"
108-
}
109-
],
110-
"toolName": "sign",
111-
"toolVersion": "1.0"
112-
},
113-
{
114-
"keyCode": "CP-230012",
115-
"operationSetCode": "SigntoolVerify",
116-
"parameters": [
117-
{
118-
"parameterName": "VerifyAll",
119-
"parameterValue": "/all"
120-
}
121-
],
122-
"toolName": "sign",
123-
"toolVersion": "1.0"
124-
}
125-
]
126-
SessionTimeout: 120
140+
ESRP: 'ESRP CodeSign'
127141

128142
- powershell: |
129143
$ErrorActionPreference = "Stop"
130-
npm run gulp -- "vscode-win32-$(VSCODE_ARCH)-archive" "vscode-win32-$(VSCODE_ARCH)-system-setup" "vscode-win32-$(VSCODE_ARCH)-user-setup"
131-
132-
- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@1
133-
inputs:
134-
ConnectedServiceName: 'ESRP CodeSign'
135-
FolderPath: '$(agent.builddirectory)'
136-
Pattern: VSCodeSetup.exe
137-
signConfigType: inlineSignParams
138-
inlineOperation: |
139-
[
140-
{
141-
"keyCode": "CP-229803",
142-
"operationSetCode": "SigntoolSign",
143-
"parameters": [
144-
{
145-
"parameterName": "OpusName",
146-
"parameterValue": "VS Code"
147-
},
148-
{
149-
"parameterName": "OpusInfo",
150-
"parameterValue": "https://code.visualstudio.com/"
151-
},
152-
{
153-
"parameterName": "PageHash",
154-
"parameterValue": "/NPH"
155-
},
156-
{
157-
"parameterName": "TimeStamp",
158-
"parameterValue": "/t \"http://ts4096.gtm.microsoft.com/TSS/AuthenticodeTS\""
159-
}
160-
],
161-
"toolName": "sign",
162-
"toolVersion": "1.0"
163-
},
164-
{
165-
"keyCode": "CP-230012",
166-
"operationSetCode": "SigntoolSign",
167-
"parameters": [
168-
{
169-
"parameterName": "OpusName",
170-
"parameterValue": "VS Code"
171-
},
172-
{
173-
"parameterName": "OpusInfo",
174-
"parameterValue": "https://code.visualstudio.com/"
175-
},
176-
{
177-
"parameterName": "Append",
178-
"parameterValue": "/as"
179-
},
180-
{
181-
"parameterName": "FileDigest",
182-
"parameterValue": "/fd \"SHA256\""
183-
},
184-
{
185-
"parameterName": "PageHash",
186-
"parameterValue": "/NPH"
187-
},
188-
{
189-
"parameterName": "TimeStamp",
190-
"parameterValue": "/tr \"http://rfc3161.gtm.corp.microsoft.com/TSS/HttpTspServer\" /td sha256"
191-
}
192-
],
193-
"toolName": "sign",
194-
"toolVersion": "1.0"
195-
},
196-
{
197-
"keyCode": "CP-230012",
198-
"operationSetCode": "SigntoolVerify",
199-
"parameters": [
200-
{
201-
"parameterName": "VerifyAll",
202-
"parameterValue": "/all"
203-
}
204-
],
205-
"toolName": "sign",
206-
"toolVersion": "1.0"
207-
}
208-
]
209-
SessionTimeout: 120
144+
.\build\tfs\win32\import-esrp-auth-cert.ps1 -AuthCertificateBase64 $(ESRP_AUTH_CERTIFICATE) -AuthCertificateKey $(ESRP_AUTH_CERTIFICATE_KEY)
145+
displayName: Import ESRP Auth Certificate
210146
211147
- powershell: |
212148
$ErrorActionPreference = "Stop"
149+
npm run gulp -- "vscode-win32-$(VSCODE_ARCH)-archive" "vscode-win32-$(VSCODE_ARCH)-system-setup" "vscode-win32-$(VSCODE_ARCH)-user-setup"
150+
213151
$Repo = "$(pwd)"
214152
$Root = "$Repo\.."
215153
$SystemExe = "$Repo\.build\win32-$(VSCODE_ARCH)\system-setup\VSCodeSetup.exe"
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<configuration>
3+
<packageSources>
4+
<add key="ESRP" value="https://microsoft.pkgs.visualstudio.com/_packaging/ESRP/nuget/v3/index.json" />
5+
</packageSources>
6+
</configuration>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<packages>
3+
<package id="EsrpClient" version="1.0.27" />
4+
</packages>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
Param(
2+
[string]$AuthCertificateBase64,
3+
[string]$AuthCertificateKey
4+
)
5+
6+
# Import auth certificate
7+
$AuthCertificateFileName = [System.IO.Path]::GetTempFileName()
8+
$AuthCertificateBytes = [Convert]::FromBase64String($AuthCertificateBase64)
9+
[IO.File]::WriteAllBytes($AuthCertificateFileName, $AuthCertificateBytes)
10+
$AuthCertificate = Import-PfxCertificate -FilePath $AuthCertificateFileName -CertStoreLocation Cert:\LocalMachine\My -Password (ConvertTo-SecureString $AuthCertificateKey -AsPlainText -Force)
11+
rm $AuthCertificateFileName
12+
$ESRPAuthCertificateSubjectName = $AuthCertificate.Subject
13+
14+
Write-Output ("##vso[task.setvariable variable=ESRPAuthCertificateSubjectName;]$ESRPAuthCertificateSubjectName")

0 commit comments

Comments
 (0)