Skip to content
Open
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
9 changes: 8 additions & 1 deletion .azuredevops/pipelines/build-and-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,13 @@ stages:
feedsToUse: select
restoreArguments: --locked-mode

- task: GetAzureAuthToken@5
name: KeyVaultToken
displayName: Get token to code signing certificate
inputs:
ServiceConnection: Code signer
AccessScopes: https://vault.azure.net/.default

- task: DotNetCoreCLI@2
displayName: Build
inputs:
Expand All @@ -55,7 +62,7 @@ stages:
configuration: ${{ variables.Configuration }}
arguments: --no-restore
env:
AuthenticodeClientSecret: $(AuthenticodeClientSecret)
AuthenticodeAccessToken: $(KeyVaultToken.AuthToken)
# Roll-forward behavior set for AzureSignTool dotnet tool (see .config\dotnet-tools.json) which requires .Net 6.0 runtime
DOTNET_ROLL_FORWARD: Major

Expand Down
1 change: 0 additions & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
<RootNamespace>Kentico.Xperience.Disqus</RootNamespace>

<EnableDefaultEmbeddedResourceItems>false</EnableDefaultEmbeddedResourceItems>
Copy link

Copilot AI Jan 21, 2026

Choose a reason for hiding this comment

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

The TimestampServerUrl property has been removed from this file, but it is still referenced in Directory.build.targets at line 12. This will cause the build to fail because the variable will be undefined. The TimestampServerUrl needs to either remain defined here or be added to the Azure DevOps variable group "Code Sign KV Auth".

Copilot uses AI. Check for mistakes.
<TimestampServerUrl>http://timestamp.digicert.com</TimestampServerUrl>
</PropertyGroup>

<PropertyGroup Condition=" $(Configuration) == 'Release' ">
Expand Down
4 changes: 2 additions & 2 deletions Directory.build.targets
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<Project>
<Target Name="SignAssemblyWithAuthenticodeSignature" AfterTargets="AfterBuild" Condition="'$(MSBuildProjectFullPath.Contains(&quot;node_modules&quot;))' == 'false' And $(Configuration) == 'Release' And $(SIGN_FILE) != 'false'">
<Target Name="SignAssemblyWithAuthenticodeSignature" AfterTargets="AfterBuild" Condition="'$(MSBuildProjectFullPath.Contains(&quot;node_modules&quot;))' == 'false' And $(Configuration) == 'Release' And $(SIGN_FILE) == 'true'">
<PropertyGroup>
<XmlSerializersTargetPath>$(TargetDir)$(TargetName).XmlSerializers.dll</XmlSerializersTargetPath>
</PropertyGroup>
Expand All @@ -9,6 +9,6 @@
<AssemblyToSign Include="$(XmlSerializersTargetPath)" Condition="Exists('$(XmlSerializersTargetPath)')" />
</ItemGroup>

<Exec Command="dotnet AzureSignTool sign --azure-key-vault-url $(AuthenticodeKeyVaultUrl) --azure-key-vault-tenant-id $(AuthenticodeTenantId) --azure-key-vault-client-id $(AuthenticodeClientId) --azure-key-vault-client-secret $(AuthenticodeClientSecret) --azure-key-vault-certificate $(AuthenticodeCertificateName) --timestamp-rfc3161 $(TimestampServerUrl) --skip-signed %(AssemblyToSign.Identity)" />
<Exec Command="dotnet AzureSignTool sign --azure-key-vault-url $(AuthenticodeKeyVaultUrl) --azure-key-vault-accesstoken $(AuthenticodeAccessToken) --azure-key-vault-certificate $(AuthenticodeCertificateName) --timestamp-rfc3161 $(TimestampServerUrl) --skip-signed %(AssemblyToSign.Identity)" />
Copy link

Copilot AI Jan 21, 2026

Choose a reason for hiding this comment

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

$(AuthenticodeAccessToken) is passed as a command-line argument to dotnet AzureSignTool, which can expose this short-lived access token via build logs and the process table to anyone with access to the build environment. An attacker who obtains this token could use it to access the Azure Key Vault certificate or sign arbitrary code during the token lifetime. Prefer passing the token via a secure channel such as an environment variable or dedicated input mechanism that does not echo the secret in logs or process listings.

Suggested change
<Exec Command="dotnet AzureSignTool sign --azure-key-vault-url $(AuthenticodeKeyVaultUrl) --azure-key-vault-accesstoken $(AuthenticodeAccessToken) --azure-key-vault-certificate $(AuthenticodeCertificateName) --timestamp-rfc3161 $(TimestampServerUrl) --skip-signed %(AssemblyToSign.Identity)" />
<Exec Command="dotnet AzureSignTool sign --azure-key-vault-url $(AuthenticodeKeyVaultUrl) --azure-key-vault-certificate $(AuthenticodeCertificateName) --timestamp-rfc3161 $(TimestampServerUrl) --skip-signed %(AssemblyToSign.Identity)" EnvironmentVariables="AZURE_KEY_VAULT_ACCESS_TOKEN=$(AuthenticodeAccessToken)" />

Copilot uses AI. Check for mistakes.
</Target>
</Project>
Loading