You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(signing): ✨ Add certificate validation options for code signing
- Introduced `-SkipValidation` parameter to bypass validation checks for certificates from `EnvVar` or `PfxFile` sources.
- Enhanced error handling for missing or invalid certificates.
- Updated localization strings for better clarity on certificate validation messages.
if ([String]$PSBPreference.Build.Dependencies-ne [String]$__DefaultBuildDependencies) {
191
191
throw [NotSupportedException]'You cannot use $PSBPreference.Build.Dependencies with Invoke-Build. Please instead redefine the build task or your default task to include your dependencies. Example: Task . Dependency1,Dependency2,Build,Test or Task Build Dependency1,Dependency2,StageFiles'
192
192
}
193
-
},StageFiles,BuildHelp
193
+
},StageFiles,BuildHelp
194
194
195
195
# Synopsis: Execute Pester and ScriptAnalyzer tests
196
-
task Test Analyze,Pester
196
+
Task Test Analyze,Pester
197
197
198
-
task. Build,Test
198
+
Task. Build,Test
199
199
200
200
# Synopsis: Signs module files (*.psd1, *.psm1, *.ps1) with an Authenticode signature
201
-
task SignModule -If {
201
+
Task SignModule -If {
202
202
if (-not$PSBPreference.Sign.Enabled) {
203
203
Write-Warning'Module signing is not enabled.'
204
204
return$false
@@ -246,7 +246,7 @@ task SignModule -If {
246
246
}
247
247
248
248
# Synopsis: Creates a Windows catalog (.cat) file for the built module
249
-
task BuildCatalog -If {
249
+
Task BuildCatalog -If {
250
250
if (-not ($PSBPreference.Sign.Enabled-and$PSBPreference.Sign.Catalog.Enabled)) {
251
251
Write-Warning'Catalog generation is not enabled.'
252
252
return$false
@@ -273,13 +273,13 @@ task BuildCatalog -If {
273
273
}
274
274
275
275
# Synopsis: Signs the module catalog (.cat) file with an Authenticode signature
276
-
task SignCatalog -If {
276
+
Task SignCatalog -If {
277
277
if (-not ($PSBPreference.Sign.Enabled-and$PSBPreference.Sign.Catalog.Enabled)) {
278
278
Write-Warning'Catalog signing is not enabled.'
279
279
return$false
280
280
}
281
281
if (-not (Get-Command-Name 'Set-AuthenticodeSignature'-ErrorAction Ignore)) {
282
-
Write-Warning'Set-AuthenticodeSignature is not available. Module signing requires Windows.'
282
+
Write-Warning'Set-AuthenticodeSignature is not available. Catalog signing requires Windows.'
283
283
return$false
284
284
}
285
285
$true
@@ -327,6 +327,6 @@ task SignCatalog -If {
327
327
}
328
328
329
329
# Synopsis: Signs module files and catalog (meta task)
Justification ='This is not a password in plain text. It is the name of an environment variable that contains the password, which is a common pattern for CI/CD pipelines and secrets management.'
throw"Environment variable '$CertificateEnvVar' is not set or is empty. When using CertificateSource='EnvVar', you must provide a Base64-encoded PFX in this variable."
CertificateSourceAutoResolved=CertificateSource is 'Auto'. Resolved to '{0}'.
35
+
CertificateMissingPrivateKey=The resolved certificate does not have an accessible private key. Code signing requires a certificate with a private key. Subject=[{0}]
36
+
CertificateExpired=The resolved certificate has expired (NotAfter: {0}). Code signing requires a valid, unexpired certificate. Subject=[{1}]
37
+
CertificateMissingCodeSigningEku=The resolved certificate does not have the Code Signing Enhanced Key Usage (EKU: 1.3.6.1.5.5.7.3.3). Subject=[{0}]
0 commit comments