Skip to content

Windows: Cannot use Temurin to build release artifacts #4242

Closed

Description

@infeo

We would like to streamline our CI by only using Adoptium Temurin JDK.

Currently, we only differ in the in the windows build:

- arch: x64
os: windows-latest
java-dist: 'zulu' #cannot use temurin, see https://github.com/cryptomator/cryptomator/issues/3824#issuecomment-2829827427
java-version: '25.0.1+8'
java-package: 'jdk'

This is necessary, because signing Temurin builds fails (i.e. #3693). The JDK bug got fixed in JDK 25 and changes were implemented in Temurin JDK 26.

Branch https://github.com/cryptomator/cryptomator/tree/feature/jdk26 tries the Temurin JDK with the fixes.

References:

Activity

  1. infeo commented on Jun 1, 2026

    @infeo
    MemberAuthor

    Run https://github.com/cryptomator/cryptomator/actions/runs/26744309908 created a signed installer for testing.

    But the install experience is bad: Even though the installer is signed with Microsofts Azure/artifact-signing, it triggers the Smart App Control dialog, indicating that the installer is not trusted.

    We need to log an installer run with SAC and analyse it with #3130 (comment)

  2. infeo commented on Jun 1, 2026

    @infeo
    MemberAuthor

    Generated a manual for easier testing:

    Important: Microsoft’s registry-based Smart App Control configuration method is intended for testing only. It requires using the Windows Recovery Command Prompt to edit offline registry hives. Do not use this on production machines unless you understand the security impact.

    Source manual:
    https://learn.microsoft.com/en-us/windows/apps/develop/smart-app-control/test-your-app-with-smart-app-control#configure-smart-app-control-by-using-the-registry


    Why this cannot be fully automated from normal Windows

    A single normal PowerShell script cannot safely perform the full configuration because Microsoft’s procedure requires booting into:

    Advanced Startup → Troubleshoot → Advanced options → Command Prompt

    From there, you edit the offline Windows registry hives:

    • SYSTEM
    • SOFTWARE

    The script below automates the Windows-side preparation and creates a .cmd file that you run from the Recovery Command Prompt.


    Smart App Control mode values

    Mode Registry value
    Off 0
    Enforcement / On 1
    Evaluation 2

    PowerShell preparation script

    Save the following as:

    Prepare-SmartAppControlTest.ps1

    Then run it from an elevated PowerShell window.

    <#
    .SYNOPSIS
    Prepares Smart App Control registry configuration for testing.
    
    .DESCRIPTION
    This script performs the Windows-side preparation from Microsoft's Smart App Control
    testing instructions, then creates a CMD file that you run from the Windows Recovery
    Command Prompt to set the desired SAC mode.
    
    Run this PowerShell script as Administrator.
    
    .PARAMETER Mode
    Smart App Control mode to configure:
    - Off
    - Enforcement
    - Evaluation
    
    .PARAMETER WindowsDrive
    The Windows system drive as seen from Recovery Command Prompt.
    Usually C:, but adjust if needed.
    
    .PARAMETER RebootToRecovery
    If set, the script will reboot into Advanced Startup after preparation.
    
    .EXAMPLE
    .\Prepare-SmartAppControlTest.ps1 -Mode Enforcement -RebootToRecovery
    
    .EXAMPLE
    .\Prepare-SmartAppControlTest.ps1 -Mode Evaluation
    #>
    
    param(
        [Parameter(Mandatory = $true)]
        [ValidateSet("Off", "Enforcement", "Evaluation")]
        [string]$Mode,
    
        [string]$WindowsDrive = "C:",
    
        [switch]$RebootToRecovery
    )
    
    $ErrorActionPreference = "Stop"
    
    function Assert-Administrator {
        $identity = [Security.Principal.WindowsIdentity]::GetCurrent()
        $principal = New-Object Security.Principal.WindowsPrincipal($identity)
    
        if (-not $principal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
            throw "Please run this PowerShell script as Administrator."
        }
    }
    
    Assert-Administrator
    
    $modeValue = switch ($Mode) {
        "Off"          { 0 }
        "Enforcement" { 1 }
        "Evaluation"  { 2 }
    }
    
    $windowsDriveNoSlash = $WindowsDrive.TrimEnd("\")
    $cmdPath = Join-Path $env:SystemDrive "Set-SmartAppControl-$Mode.cmd"
    
    Write-Host "Preparing Smart App Control test configuration..."
    Write-Host "Requested mode: $Mode ($modeValue)"
    Write-Host "Windows drive for Recovery Command Prompt: $windowsDriveNoSlash"
    Write-Host ""
    
    Write-Host "Disabling BitLocker protectors for two reboots..."
    manage-bde -protectors $env:SystemDrive -disable -rebootcount 2
    
    $mpCmdRun = Join-Path $env:ProgramFiles "Windows Defender\MpCmdRun.exe"
    
    if (-not (Test-Path $mpCmdRun)) {
        throw "Could not find MpCmdRun.exe at expected path: $mpCmdRun"
    }
    
    Write-Host "Removing Microsoft Defender dynamic signatures..."
    & $mpCmdRun -RemoveDefinitions -DynamicSignatures
    
    $cmdContent = @"
    @echo off
    echo Loading offline SYSTEM hive...
    reg load HKLM\sac $windowsDriveNoSlash\windows\system32\config\system
    if errorlevel 1 goto error
    
    echo Setting Smart App Control policy state to $Mode ($modeValue)...
    reg add hklm\sac\controlset001\control\ci\policy /v VerifiedAndReputablePolicyState /t REG_DWORD /d $modeValue /f
    if errorlevel 1 goto error
    
    reg add hklm\sac\controlset001\control\ci\protected /v VerifiedAndReputablePolicyStateMinValueSeen /t REG_DWORD /d $modeValue /f
    if errorlevel 1 goto error
    
    echo Unloading SYSTEM hive...
    reg unload hklm\sac
    if errorlevel 1 goto error
    
    echo Loading offline SOFTWARE hive...
    reg load HKLM\sac2 $windowsDriveNoSlash\windows\system32\config\SOFTWARE
    if errorlevel 1 goto error
    
    echo Disabling SAC learning mode switch...
    reg add "hklm\sac2\Microsoft\Windows Defender" /v SacLearningModeSwitch /t REG_DWORD /d 0 /f
    if errorlevel 1 goto error
    
    echo Unloading SOFTWARE hive...
    reg unload hklm\sac2
    if errorlevel 1 goto error
    
    echo.
    echo Smart App Control registry configuration completed.
    echo Restart the computer now.
    pause
    exit /b 0
    
    :error
    echo.
    echo An error occurred. Check that the Windows drive letter is correct.
    echo In Recovery Command Prompt, the Windows drive is usually C:, but not always.
    pause
    exit /b 1
    "@
    
    Set-Content -Path $cmdPath -Value $cmdContent -Encoding ASCII
    
    Write-Host ""
    Write-Host "Created Recovery Command Prompt script:"
    Write-Host "  $cmdPath"
    Write-Host ""
    Write-Host "Next steps:"
    Write-Host "1. Boot into Advanced Startup > Troubleshoot > Advanced options > Command Prompt."
    Write-Host "2. In the Recovery Command Prompt, run:"
    Write-Host "   $cmdPath"
    Write-Host "3. Restart Windows."
    Write-Host "4. Verify the mode with:"
    Write-Host "   citool.exe -lp"
    Write-Host ""
    
    if ($RebootToRecovery) {
        Write-Host "Rebooting into Advanced Startup..."
        shutdown.exe /r /o /t 0
    }

    Usage examples

    Configure Smart App Control enforcement mode

    .\Prepare-SmartAppControlTest.ps1 -Mode Enforcement -RebootToRecovery

    Configure Smart App Control evaluation mode

    .\Prepare-SmartAppControlTest.ps1 -Mode Evaluation -RebootToRecovery

    Configure Smart App Control off mode

    .\Prepare-SmartAppControlTest.ps1 -Mode Off -RebootToRecovery

    Recovery Command Prompt step

    After the machine reboots into Advanced Startup:

    1. Select Troubleshoot.
    2. Select Advanced options.
    3. Select Command Prompt.
    4. Run the generated command file.

    For enforcement mode:

    C:\Set-SmartAppControl-Enforcement.cmd

    For evaluation mode:

    C:\Set-SmartAppControl-Evaluation.cmd

    For off mode:

    C:\Set-SmartAppControl-Off.cmd

    If the command fails, the Windows drive letter may not be C: inside the Recovery Command Prompt. You can inspect available drives with:

    diskpart
    list volume
    exit

    Then rerun the PowerShell preparation script later with the correct drive letter, for example:

    .\Prepare-SmartAppControlTest.ps1 -Mode Enforcement -WindowsDrive D: -RebootToRecovery

    Verify Smart App Control state

    After restarting into Windows, verify the configured policy state with:

    citool.exe -lp

    Expected signs:

    • Enforcement mode: Friendly Name is VerifiedAndReputableDesktop and Is Currently Enforced is true.
    • Evaluation mode: Friendly Name is VerifiedAndReputableDesktopEvaluation and Is Currently Enforced is true.

    Notes and cautions

    • Run the PowerShell script as Administrator.
    • The script temporarily disables BitLocker protectors for two reboots using manage-bde.
    • The script removes Microsoft Defender dynamic signatures before the offline registry change.
    • The registry configuration is for testing Smart App Control behavior, not for general deployment.
    • Prefer using a test machine or virtual machine.
  3. added this to the Backlog milestone on Jun 1, 2026
  4. infeo commented on Jun 25, 2026

    @infeo
    MemberAuthor

    The bad UX (Windows Smart Screen popup) was verly likely caused by #4260 . This is fixed now, so we can retest.

  5. modified the milestones: Backlog, next on Jun 25, 2026
  6. added a commit that references this issue on Jun 25, 2026
    f748bfd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions