feat(core): RDP client on IronRDP

clients::rdp connects over any caller-dialled TCP stream (direct, proxy
or SSH tunnel), upgrades to TLS and logs on with NLA (CredSSP/NTLM),
optionally falling back to TLS-only logon for servers without NLA such
as xrdp (credentials are passed so they log straight in). The server
certificate is pinned through a caller check on its SHA256 fingerprint
before any credentials are sent. The desktop decodes into the VNC
client's RGBA framebuffer; input (IronRDP's scancode/Unicode/mouse
operations), Display Control resizes and the deactivation-reactivation
sequence run on the session thread.

IronRDP's releases need three vendored patches (vendor/README.md):
picky and sspi with their RustCrypto release-candidate pins relaxed so
they share russh's stable versions (their own suites, 402 tests, pass
against them), and ironrdp-session with two unreleased upstream bitmap
fixes (#1486 stride, #1524 RDP6 orientation) without which xrdp desktops
render sheared.

Verified live against xrdp (scottyhardy/docker-remote-desktop): logon,
full desktop rendering, keyboard and mouse input.
This commit is contained in:
Andy Dixon
2026-10-12 10:50:24 +01:00
parent 6a4d7381d9
commit 50c0104d57
227 changed files with 66687 additions and 20 deletions
+3
View File
@@ -0,0 +1,3 @@
# File auto-generated and managed by Devops
/.github/ @devolutions/devops @devolutions/architecture-maintainers
/.github/dependabot.yml @devolutions/security-managers
+38
View File
@@ -0,0 +1,38 @@
version: 2
updates:
- package-ecosystem: "cargo"
directories:
- "/"
- "/fuzz/"
schedule:
interval: "weekly"
assignees:
- "CBenoit"
open-pull-requests-limit: 3
groups:
crypto:
patterns:
- "md-5"
- "md5"
- "md4"
- "sha1"
- "sha2"
- "sha3"
- "pkcs*"
- "x509-cert"
- "hmac"
- "der"
- "crypto-mac"
- "*tls*"
- "*rand*"
- "picky*"
windows:
patterns:
- "windows*"
- "winapi"
patch:
dependency-type: "production"
update-types:
- "patch"
dev:
dependency-type: "development"
+503
View File
@@ -0,0 +1,503 @@
name: Build Native
on:
workflow_call:
jobs:
preflight:
name: Preflight
runs-on: ubuntu-latest
outputs:
project-version: ${{ steps.get-version.outputs.project-version }}
package-version: ${{ steps.get-version.outputs.package-version }}
steps:
- name: Checkout ${{ github.repository }}
uses: actions/checkout@v6
- name: Get version
id: get-version
shell: pwsh
run: |
$CsprojXml = [Xml] (Get-Content .\ffi\dotnet\Devolutions.Sspi\Devolutions.Sspi.csproj)
$ProjectVersion = $CsprojXml.Project.PropertyGroup.Version | Select-Object -First 1
$PackageVersion = $ProjectVersion -Replace "^(\d+)\.(\d+)\.(\d+).(\d+)$", "`$1.`$2.`$3"
echo "project-version=$ProjectVersion" >> $Env:GITHUB_OUTPUT
echo "package-version=$PackageVersion" >> $Env:GITHUB_OUTPUT
build-native:
name: Native build
runs-on: ${{ matrix.runner }}
needs: preflight
strategy:
fail-fast: false
matrix:
os: [ win, osx, linux, ios, iossimulator, android ]
arch: [ x86, x64, arm, arm64 ]
build: [ debug, release ]
include:
- os: win
runner: windows-2022
- os: osx
runner: macos-14
- os: linux
runner: ubuntu-22.04
- os: ios
runner: macos-14
- os: iossimulator
runner: macos-14
- os: android
runner: ubuntu-22.04
exclude:
- arch: arm
os: win
- arch: arm
os: osx
- arch: arm
os: linux
- arch: arm
os: ios
- arch: x86
os: win
- arch: x86
os: osx
- arch: x86
os: linux
- arch: x86
os: ios
- arch: x64
os: ios
- arch: arm
os: iossimulator
- arch: x86
os: iossimulator
- arch: x64
os: iossimulator
steps:
- name: Checkout ${{ github.repository }}
uses: actions/checkout@v6
- name: Configure Android NDK
uses: Devolutions/actions-public/cargo-android-ndk@v1
if: matrix.os == 'android'
with:
android_api_level: "21"
- name: Install dependencies for rustls
if: runner.os == 'Windows'
shell: pwsh
run: |
choco install ninja nasm
# We need to add the NASM binary folder to the PATH manually.
# We don’t need to do that for ninja.
Write-Output "PATH=$Env:PATH;$Env:ProgramFiles\NASM" >> $Env:GITHUB_ENV
# libclang / LLVM is a requirement for AWS LC.
# https://aws.github.io/aws-lc-rs/requirements/windows.html#libclang--llvm
$VSINSTALLDIR = $(vswhere.exe -latest -requires Microsoft.VisualStudio.Component.VC.Llvm.Clang -property installationPath)
Write-Output "LIBCLANG_PATH=$VSINSTALLDIR\VC\Tools\Llvm\x64\bin" >> $Env:GITHUB_ENV
# Install Visual Studio Developer PowerShell Module for cmdlets such as Enter-VsDevShell
Install-Module VsDevShell -Force
- name: Install dependencies
if: matrix.os == 'ios' || matrix.os == 'iossimulator'
run: cargo install --force --locked bindgen-cli
- name: Setup build environment
shell: pwsh
run: |
if ('${{ matrix.os }}' -Eq 'osx') {
echo "MACOSX_DEPLOYMENT_TARGET=10.10" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
} elseif ('${{ matrix.os }}' -Eq 'ios') {
echo "IPHONEOS_DEPLOYMENT_TARGET=12.1" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
} elseif ('${{ matrix.os }}' -Eq 'iossimulator') {
echo "IPHONESIMULATOR_DEPLOYMENT_TARGET=12.1" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
$SimulatorSdk = xcrun --sdk iphonesimulator --show-sdk-path
echo "SDKROOT=$SimulatorSdk" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
}
- name: Setup LLVM
uses: Devolutions/actions-public/setup-llvm@v1
if: matrix.os == 'linux'
with:
version: "18.1.8"
- name: Setup CBake
uses: Devolutions/actions-public/setup-cbake@v1
if: matrix.os == 'linux'
with:
sysroots: |
- ubuntu-20.04-amd64
- ubuntu-20.04-arm64
cargo_env_scripts: true
- name: Build sspi (${{matrix.os}}-${{matrix.arch}}) (${{matrix.build}})
shell: pwsh
run: |
Set-PSDebug -Trace 1
$BuildType = '${{matrix.build}}'
$DotNetOs = '${{matrix.os}}'
$DotNetArch = '${{matrix.arch}}'
$DotNetRid = '${{matrix.os}}-${{matrix.arch}}'
$RustArch = @{'x64'='x86_64';'arm64'='aarch64';
'x86'='i686';'arm'='armv7'}[$DotNetArch]
$AppleArch = @{'x64'='x86_64';'arm64'='arm64';
'x86'='i386';'arm'='arm'}[$DotNetArch]
$MsvcArch = @{'x64'='x64';'arm64'='arm64'}[$DotNetArch]
$RustPlatform = @{'win'='pc-windows-msvc';
'osx'='apple-darwin';'ios'='apple-ios';'iossimulator'='apple-ios-sim';
'linux'='unknown-linux-gnu';'android'='linux-android'}[$DotNetOs]
$LibPrefix = @{'win'='';'osx'='lib';'ios'='lib';'iossimulator'='lib';
'linux'='lib';'android'='lib'}[$DotNetOs]
$LibSuffix = @{'win'='.dll';'osx'='.dylib';'ios'='.dylib';'iossimulator'='.dylib';
'linux'='.so';'android'='.so'}[$DotNetOs]
$RustTarget = "$RustArch-$RustPlatform"
$TargetFolder = @{'debug'='debug';'release'='ffi-production'}[$BuildType]
if (($DotNetOs -eq 'android') -and ($DotNetArch -eq 'arm')) {
$RustTarget = "armv7-linux-androideabi"
}
if ($DotNetOs -eq 'osx') {
Set-Item "Env:CFLAGS_${RustArch}-apple-darwin" "-arch $AppleArch"
}
rustup target add $RustTarget
if ($DotNetOs -eq 'win') {
Enter-VsDevShell $MsvcArch
$Env:RUSTFLAGS="-C target-feature=+crt-static"
}
$ProjectVersion = '${{ needs.preflight.outputs.project-version }}'
$PackageVersion = '${{ needs.preflight.outputs.package-version }}'
$CargoToml = Get-Content .\ffi\Cargo.toml
$CargoToml = $CargoToml | ForEach-Object {
if ($_.StartsWith("version =")) { "version = `"$PackageVersion`"" } else { $_ }
}
Set-Content -Path .\ffi\Cargo.toml -Value $CargoToml
$CargoArgs = @('build', '-vvv', '-p', 'sspi-ffi', '--target', $RustTarget)
if (-Not ($BuildType -Eq 'debug')) {
$CargoArgs += @('--profile', 'ffi-production')
}
if ($DotNetOs -Eq 'win') {
$CargoArgs += @('--features', 'tsssp')
}
# No pregenerated Android bindings are provided for aws-lc-sys at this time.
# See: https://github.com/aws/aws-lc-rs/tree/main/aws-lc-sys#pregenerated-bindings-availability
# For simplicity, we’re using the ring crypto backend.
if ($DotNetOs -Eq 'android') {
$CargoArgs += @('--no-default-features', '--features', 'scard,ring')
}
if ($DotNetOs -eq 'linux') {
$LinuxArch = @{'x64'='amd64';'arm64'='arm64'}[$DotNetArch]
$Env:SYSROOT_NAME = "ubuntu-20.04-$LinuxArch"
. "$HOME/.cargo/cbake/${RustTarget}-enter.ps1"
$Env:AWS_LC_SYS_CMAKE_BUILDER="true"
}
$CargoCmd = $(@('cargo') + $CargoArgs) -Join ' '
Write-Host $CargoCmd
& cargo $CargoArgs | Out-Host
$OutputLibraryName = "${LibPrefix}sspi$LibSuffix"
$RenamedLibraryName = "${LibPrefix}DevolutionsSspi$LibSuffix"
$OutputLibrary = Join-Path "target" $RustTarget $TargetFolder $OutputLibraryName
$OutputPath = Join-Path "dependencies" "runtimes" $DotNetRid "native"
New-Item -ItemType Directory -Path $OutputPath | Out-Null
Copy-Item $OutputLibrary $(Join-Path $OutputPath $RenamedLibraryName)
# Export variables for symbol collection step
echo "RUST_TARGET=$RustTarget" >> $Env:GITHUB_ENV
echo "TARGET_FOLDER=$TargetFolder" >> $Env:GITHUB_ENV
echo "LIB_PREFIX=$LibPrefix" >> $Env:GITHUB_ENV
echo "DOTNET_OS=$DotNetOs" >> $Env:GITHUB_ENV
echo "DOTNET_RID=$DotNetRid" >> $Env:GITHUB_ENV
- name: Collect debug symbols
if: matrix.build == 'release'
shell: pwsh
run: |
Set-PSDebug -Trace 1
$DotNetOs = $Env:DOTNET_OS
$DotNetRid = $Env:DOTNET_RID
$RustTarget = $Env:RUST_TARGET
$TargetFolder = $Env:TARGET_FOLDER
$LibPrefix = $Env:LIB_PREFIX
$SymbolsPath = Join-Path "symbols" $DotNetRid
New-Item -ItemType Directory -Path $SymbolsPath -Force | Out-Null
$TargetDir = Join-Path "target" $RustTarget $TargetFolder
if ($DotNetOs -eq 'win') {
# Windows: Copy PDB file
$PdbFile = Join-Path $TargetDir "sspi.pdb"
if (Test-Path $PdbFile) {
Copy-Item $PdbFile (Join-Path $SymbolsPath "DevolutionsSspi.pdb")
Write-Host "Copied PDB: $PdbFile"
} else {
Write-Warning "PDB file not found: $PdbFile"
Get-ChildItem $TargetDir -Filter "*.pdb" | ForEach-Object { Write-Host "Found PDB: $($_.FullName)" }
}
} elseif ($DotNetOs -eq 'osx' -or $DotNetOs -eq 'ios' -or $DotNetOs -eq 'iossimulator') {
# macOS/iOS: Generate dSYM bundle using dsymutil
$DylibFile = Join-Path $TargetDir "${LibPrefix}sspi.dylib"
$DsymOutput = Join-Path $SymbolsPath "libDevolutionsSspi.dylib.dSYM"
if (Test-Path $DylibFile) {
& dsymutil $DylibFile -o $DsymOutput
Write-Host "Generated dSYM: $DsymOutput"
} else {
Write-Warning "Dylib file not found: $DylibFile"
}
} elseif ($DotNetOs -eq 'linux' -or $DotNetOs -eq 'android') {
# Linux/Android: Extract debug info into a separate file
$DwpFile = Join-Path $TargetDir "${LibPrefix}sspi.dwp"
$SoFile = Join-Path $TargetDir "${LibPrefix}sspi.so"
$DebugOutput = Join-Path $SymbolsPath "libDevolutionsSspi.so.debug"
if (Test-Path $DwpFile) {
# split-debuginfo=packed may produce a .dwp file
Copy-Item $DwpFile (Join-Path $SymbolsPath "libDevolutionsSspi.so.dwp")
Write-Host "Copied DWP: $DwpFile"
} elseif (Test-Path $SoFile) {
# Extract debug sections from the binary using objcopy
if ($DotNetOs -eq 'android') {
$ObjCopy = Join-Path $Env:ANDROID_NDK_HOME "toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-objcopy"
if (-not (Test-Path $ObjCopy)) {
throw "llvm-objcopy not found at $ObjCopy"
}
} else {
$ObjCopy = 'llvm-objcopy'
$ObjCopyCmd = Get-Command $ObjCopy -ErrorAction SilentlyContinue
if (-not $ObjCopyCmd) {
throw "llvm-objcopy not found on PATH"
}
}
Write-Host "Extracting debug info with: $ObjCopy --only-keep-debug"
& $ObjCopy --only-keep-debug $SoFile $DebugOutput 2>&1 | Write-Host
Write-Host "Extracted debug info: $DebugOutput"
$SizeMB = [math]::Round((Get-Item $DebugOutput).Length / 1MB, 2)
Write-Host "Debug file size: $SizeMB MB"
} else {
Write-Warning "No debug symbols found for Linux/Android"
}
}
# List collected symbols
Write-Host "Collected symbols:"
Get-ChildItem -Recurse $SymbolsPath | ForEach-Object { Write-Host $_.FullName }
- name: Strip release binaries
if: matrix.build == 'release'
shell: pwsh
run: |
$DotNetOs = $Env:DOTNET_OS
$DotNetRid = $Env:DOTNET_RID
$LibPrefix = $Env:LIB_PREFIX
$RuntimePath = Join-Path "dependencies" "runtimes" "$DotNetRid" "native"
if ($DotNetOs -eq 'win') {
# Windows: DLL is already separate from PDB, no stripping needed
Write-Host "Windows binaries are already compact (PDB is separate)"
} elseif ($DotNetOs -eq 'osx' -or $DotNetOs -eq 'ios' -or $DotNetOs -eq 'iossimulator') {
$DylibFile = Join-Path $RuntimePath "${LibPrefix}DevolutionsSspi.dylib"
if (Test-Path $DylibFile) {
& strip -Sx $DylibFile
Write-Host "Stripped dylib: $DylibFile"
$SizeMB = [math]::Round((Get-Item $DylibFile).Length / 1MB, 2)
Write-Host "Size after stripping: $SizeMB MB"
}
} elseif ($DotNetOs -eq 'android' -or $DotNetOs -eq 'linux') {
$SoFile = Join-Path $RuntimePath "${LibPrefix}DevolutionsSspi.so"
if (Test-Path $SoFile) {
if ($DotNetOs -eq 'android') {
$StripTool = Join-Path $Env:ANDROID_NDK_HOME "toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-strip"
} else {
$StripTool = 'llvm-strip'
}
Write-Host "Using strip tool: $StripTool"
& $StripTool --strip-unneeded $SoFile 2>&1 | Write-Host
Write-Host "Stripped .so ($DotNetOs): $SoFile"
$SizeMB = [math]::Round((Get-Item $SoFile).Length / 1MB, 2)
Write-Host "Size after stripping: $SizeMB MB"
}
}
- name: Framework (${{matrix.os}}-${{matrix.arch}}) (${{matrix.build}})
if: matrix.os == 'ios' || matrix.os == 'iossimulator'
shell: pwsh
run: |
$Version = '${{ needs.preflight.outputs.project-version }}'
$ShortVersion = '${{ needs.preflight.outputs.package-version }}'
$BundleName = "libDevolutionsSspi"
$RuntimesDir = Join-Path "dependencies" "runtimes" "${{ matrix.os }}-${{ matrix.arch }}" "native"
$FrameworkDir = Join-Path "$RuntimesDir" "$BundleName.framework"
New-Item -Path $FrameworkDir -ItemType "directory" -Force
$FrameworkExecutable = Join-Path $FrameworkDir $BundleName
Copy-Item -Path (Join-Path "$RuntimesDir" "$BundleName.dylib") -Destination $FrameworkExecutable -Force
$RPathCmd = $(@('install_name_tool', '-id', "@rpath/$BundleName.framework/$BundleName", "$FrameworkExecutable")) -Join ' '
Write-Host $RPathCmd
Invoke-Expression $RPathCmd
[xml] $InfoPlistXml = Get-Content "Info.plist"
Select-Xml -xml $InfoPlistXml -XPath "/plist/dict/key[. = 'CFBundleIdentifier']/following-sibling::string[1]" |
%{
$_.Node.InnerXml = "com.devolutions.sspi"
}
Select-Xml -xml $InfoPlistXml -XPath "/plist/dict/key[. = 'CFBundleExecutable']/following-sibling::string[1]" |
%{
$_.Node.InnerXml = $BundleName
}
Select-Xml -xml $InfoPlistXml -XPath "/plist/dict/key[. = 'CFBundleVersion']/following-sibling::string[1]" |
%{
$_.Node.InnerXml = $Version
}
Select-Xml -xml $InfoPlistXml -XPath "/plist/dict/key[. = 'CFBundleShortVersionString']/following-sibling::string[1]" |
%{
$_.Node.InnerXml = $ShortVersion
}
# Write the plist *without* a BOM
$Encoding = New-Object System.Text.UTF8Encoding($false)
$Writer = New-Object System.IO.StreamWriter((Join-Path $FrameworkDir "Info.plist"), $false, $Encoding)
$InfoPlistXml.Save($Writer)
$Writer.Close()
# .NET XML document inserts two square brackets at the end of the DOCTYPE tag
# It's perfectly valid XML, but we're dealing with plists here and dyld will not be able to read the file
((Get-Content -Path (Join-Path $FrameworkDir "Info.plist") -Raw) -Replace 'PropertyList-1.0.dtd"\[\]', 'PropertyList-1.0.dtd"') | Set-Content -Path (Join-Path $FrameworkDir "Info.plist")
- name: Upload native components
uses: actions/upload-artifact@v7
with:
name: sspi-${{matrix.os}}-${{matrix.arch}}-${{matrix.build}}
path: dependencies/runtimes/${{matrix.os}}-${{matrix.arch}}
- name: Upload debug symbols
if: matrix.build == 'release'
uses: actions/upload-artifact@v7
with:
name: sspi-${{matrix.os}}-${{matrix.arch}}-${{matrix.build}}-symbols
path: symbols/${{matrix.os}}-${{matrix.arch}}
build-universal:
name: Universal Build
runs-on: ubuntu-24.04
needs: [preflight, build-native]
strategy:
fail-fast: false
matrix:
os: [ osx ]
build: [ debug, release ]
steps:
- name: Checkout ${{ github.repository }}
uses: actions/checkout@v6
- name: Setup CCTools
uses: Devolutions/actions-public/setup-cctools@v1
- name: Install Apple strip (cctools)
if: matrix.build == 'release'
shell: pwsh
run: |
$DownloadVersion = "v2025.2.0"
$HostPlatform = "ubuntu-$(lsb_release -rs)"
$HostArch = @{'X64'='x86_64';'ARM64'='aarch64'}['${{ runner.arch }}']
$PackageBaseName = "cctools-$HostArch-$HostPlatform"
$DownloadFile = "${PackageBaseName}.tar.xz"
$BaseDownloadUrl = "https://github.com/awakecoding/llvm-prebuilt/releases/download/$DownloadVersion"
curl -L -o $DownloadFile "${BaseDownloadUrl}/${DownloadFile}"
tar -xf $DownloadFile -C /tmp
sudo mv "/tmp/${PackageBaseName}/bin/strip" /usr/bin/apple-strip
sudo chmod +x /usr/bin/apple-strip
Remove-Item $DownloadFile -Force | Out-Null
- name: Setup LLVM
uses: Devolutions/actions-public/setup-llvm@v1
if: matrix.build == 'release'
with:
version: "18.1.8"
- name: Download native components
uses: actions/download-artifact@v8
with:
path: dependencies/runtimes
- name: Lipo (${{matrix.build}})
shell: pwsh
run: |
Set-Location "dependencies/runtimes"
# No RID for universal binaries, see: https://github.com/dotnet/runtime/issues/53156
$OutputPath = Join-Path "${{ matrix.os }}-universal" "native"
New-Item -ItemType Directory -Path $OutputPath | Out-Null
$Libraries = Get-ChildItem -Recurse -Path "sspi-${{ matrix.os }}-*-${{ matrix.build }}" -Filter "*.dylib" | Foreach-Object { $_.FullName } | Select -Unique
$LipoCmd = $(@('lipo', '-create', '-output', (Join-Path -Path $OutputPath -ChildPath "libDevolutionsSspi.dylib")) + $Libraries) -Join ' '
Write-Host $LipoCmd
Invoke-Expression $LipoCmd
- name: Generate universal dSYM
if: matrix.build == 'release'
shell: pwsh
run: |
Set-PSDebug -Trace 1
$SymbolsPath = Join-Path "symbols" "${{ matrix.os }}-universal"
New-Item -ItemType Directory -Path $SymbolsPath -Force | Out-Null
$DylibFile = Join-Path "dependencies" "runtimes" "${{ matrix.os }}-universal" "native" "libDevolutionsSspi.dylib"
$DsymOutput = Join-Path $SymbolsPath "libDevolutionsSspi.dylib.dSYM"
if (Test-Path $DylibFile) {
& dsymutil $DylibFile -o $DsymOutput
Write-Host "Generated universal dSYM: $DsymOutput"
} else {
Write-Warning "Universal dylib not found: $DylibFile"
}
# List collected symbols
Write-Host "Collected symbols:"
Get-ChildItem -Recurse $SymbolsPath | ForEach-Object { Write-Host $_.FullName }
- name: Strip universal binary
if: matrix.build == 'release'
shell: pwsh
run: |
$DylibFile = Join-Path "dependencies" "runtimes" "${{ matrix.os }}-universal" "native" "libDevolutionsSspi.dylib"
if (Test-Path $DylibFile) {
if (-not (Test-Path "/usr/bin/apple-strip")) {
throw "apple-strip not found at /usr/bin/apple-strip"
}
& /usr/bin/apple-strip -Sx $DylibFile
Write-Host "Stripped universal dylib with: /usr/bin/apple-strip -Sx"
$SizeMB = [math]::Round((Get-Item $DylibFile).Length / 1MB, 2)
Write-Host "Size after stripping: $SizeMB MB"
}
- name: Upload native components
uses: actions/upload-artifact@v7
with:
name: sspi-${{ matrix.os }}-universal-${{ matrix.build }}
path: dependencies/runtimes/${{ matrix.os }}-universal
- name: Upload universal debug symbols
if: matrix.build == 'release'
uses: actions/upload-artifact@v7
with:
name: sspi-${{ matrix.os }}-universal-${{ matrix.build }}-symbols
path: symbols/${{ matrix.os }}-universal
+193
View File
@@ -0,0 +1,193 @@
name: CI
on:
push:
branches:
- master
pull_request:
types: [ opened, synchronize, reopened ]
workflow_dispatch:
jobs:
formatting:
name: Check formatting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Check formatting
shell: pwsh
run: |
Write-Host "Check formatting"
cargo fmt --all -- --check
if ($LastExitCode -eq 1) {
throw "Bad formatting, please run 'cargo +stable fmt --all'"
}
lints:
name: Lints [${{ matrix.os }}]
runs-on: ${{ matrix.runner }}
needs: formatting
strategy:
fail-fast: true
matrix:
os: [ win, osx, linux ]
include:
- os: win
runner: windows-2022
additional-args: --features tsssp
- os: osx
runner: macos-14
- os: linux
runner: ubuntu-latest
steps:
- uses: actions/checkout@v6
# Compiling the ffi module is enough to lint the whole sspi workspace
- name: Check clippy
env:
AWS_LC_SYS_NO_ASM: true
run: cargo clippy --manifest-path ffi/Cargo.toml ${{ matrix.additional-args }} -- -D warnings -D clippy::print_stdout
tests:
name: Tests [${{ matrix.os }}] [${{ matrix.crate-name }}]
runs-on: ${{ matrix.runner }}
needs: formatting
env:
SSPI_RS_IS_RUNNING_TESTS: true
strategy:
fail-fast: true
matrix:
os: [ win, osx, linux ]
manifest:
- Cargo.toml
- ffi/Cargo.toml
- crates/dpapi/Cargo.toml
- crates/winscard/Cargo.toml
- crates/dpapi-pdu/Cargo.toml
- crates/ffi-types/Cargo.toml
- crates/dpapi-core/Cargo.toml
- crates/dpapi-transport/Cargo.toml
- crates/dpapi-native-transport/Cargo.toml
include:
# Map runner per OS
- os: win
runner: windows-2022
- os: osx
runner: macos-14
- os: linux
runner: ubuntu-latest
# Map crate name per manifest
- manifest: Cargo.toml
crate-name: sspi
- manifest: ffi/Cargo.toml
crate-name: sspi-ffi
- manifest: crates/dpapi/Cargo.toml
crate-name: dpapi
- manifest: crates/winscard/Cargo.toml
crate-name: winscard
- manifest: crates/dpapi-pdu/Cargo.toml
crate-name: dpapi-pdu
- manifest: crates/ffi-types/Cargo.toml
crate-name: ffi-types
- manifest: crates/dpapi-core/Cargo.toml
crate-name: dpapi-core
- manifest: crates/dpapi-transport/Cargo.toml
crate-name: dpapi-transport
- manifest: crates/dpapi-native-transport/Cargo.toml
crate-name: dpapi-native-transport
# Per-OS feature overrides for specific manifests.
# `__test-data` enables the `tests/sspi/client_server` suite (gated on
# `all(network_client, __test-data)`), which otherwise never runs in CI.
- os: win
manifest: Cargo.toml
additional-args: --features network_client,dns_resolver,scard,tsssp,__test-data
- os: osx
manifest: Cargo.toml
additional-args: --features network_client,scard,__test-data
- os: linux
manifest: Cargo.toml
additional-args: --features network_client,dns_resolver,scard,__test-data
- os: win
manifest: ffi/Cargo.toml
additional-args: --features tsssp
- os: win
manifest: crates/dpapi/Cargo.toml
additional-args: --features tsssp
steps:
- uses: actions/checkout@v6
- name: Test
env:
AWS_LC_SYS_NO_ASM: true
run: cargo test --manifest-path ${{ matrix.manifest }} ${{ matrix.additional-args }}
miri:
name: Miri FFI tests
runs-on: ubuntu-latest
needs: formatting
env:
SSPI_RS_IS_RUNNING_TESTS: true
steps:
- uses: actions/checkout@v6
# NOTE: Pinned to a specific nightly version for reproducibility.
# Update this manually on a regular basis.
- name: Install nightly toolchain and Miri
run: |
rustup toolchain install nightly-2026-02-11 --component miri
rustup override set nightly-2026-02-11
- name: Test
run: cargo miri test --manifest-path ffi/Cargo.toml --no-default-features --features ring
wasm:
name: WASM target
runs-on: ubuntu-latest
needs: formatting
steps:
- uses: actions/checkout@v6
- name: Prepare runner
run: sudo apt-get install wabt
- name: Check
shell: pwsh
run: ./tools/wasm-testcompile/check.ps1
build-native:
name: Build native
needs: formatting
uses: ./.github/workflows/build-native.yml
success:
name: Success
runs-on: ubuntu-latest
if: ${{ always() }}
needs:
- formatting
- lints
- tests
- miri
- wasm
- build-native
steps:
- name: CI succeeded
id: succeeded
if: ${{ !contains(needs.*.result, 'failure') }}
run: exit 0
- name: CI failed
if: ${{ steps.succeeded.outcome == 'skipped' }}
run: exit 1
+322
View File
@@ -0,0 +1,322 @@
name: Publish NuGet package
on:
workflow_dispatch:
inputs:
dry-run:
description: 'Dry run'
required: true
type: boolean
default: true
version:
description: 'Package version'
default: "latest"
required: true
schedule:
- cron: '21 3 * * 1' # 3:21 AM UTC every Monday
jobs:
preflight:
name: Preflight
runs-on: ubuntu-latest
outputs:
dry-run: ${{ steps.get-dry-run.outputs.dry-run }}
package-version: ${{ steps.info.outputs.package-version }}
steps:
- name: Get dry run
id: get-dry-run
shell: pwsh
run: |
Set-PSDebug -Trace 1
$IsDryRun = '${{ github.event.inputs.dry-run }}' -Eq 'true' -Or '${{ github.event_name }}' -Eq 'schedule'
if ($IsDryRun) {
echo "dry-run=true" >> $Env:GITHUB_OUTPUT
} else {
echo "dry-run=false" >> $Env:GITHUB_OUTPUT
}
- name: Package information
id: info
shell: pwsh
run: |
$PackageVersion = '${{ inputs.version }}'
if ([string]::IsNullOrEmpty($PackageVersion) -or $PackageVersion -eq 'latest') {
$PackageVersion = (Get-Date -Format "yyyy.MM.dd") + ".0"
}
if ($PackageVersion -NotMatch '^\d+\.\d+\.\d+\.\d+$') {
throw "invalid version format: $PackageVersion, expected: 1.2.3.4"
}
echo "package-version=$PackageVersion" >> $Env:GITHUB_OUTPUT
echo "::notice::Version: $PackageVersion"
build-native:
uses: ./.github/workflows/build-native.yml
build-managed:
name: Managed build
runs-on: windows-2022
needs: [ preflight, build-native ]
steps:
- name: Check out ${{ github.repository }}
uses: actions/checkout@v6
- name: Prepare dependencies
shell: pwsh
run: |
New-Item -ItemType Directory -Path "dependencies/runtimes" | Out-Null
- name: Download native components
uses: actions/download-artifact@v8
with:
path: dependencies/runtimes
- name: Rename dependencies
shell: pwsh
run: |
Set-PSDebug -Trace 1
Set-Location "dependencies/runtimes"
$(Get-Item ".\sspi-*-release") | ForEach-Object { Rename-Item $_ $_.Name.Replace("-release", "") }
$(Get-Item ".\sspi-*") | ForEach-Object { Rename-Item $_ $_.Name.Replace("sspi-", "") }
Get-ChildItem * -Recurse
- name: Set package version
shell: pwsh
run: |
$PackageVersion = '${{ needs.preflight.outputs.package-version }}'
$csprojPath = "ffi\dotnet\Devolutions.Sspi\Devolutions.Sspi.csproj"
$csprojContent = Get-Content $csprojPath -Raw
$csprojContent = $csprojContent -Replace '(<Version>).*?(</Version>)', "<Version>$PackageVersion</Version>"
Set-Content -Path $csprojPath -Value $csprojContent -Encoding UTF8
- name: Build sspi (managed)
shell: pwsh
run: |
dotnet build .\ffi\dotnet\Devolutions.Sspi\Devolutions.Sspi.csproj -o package
- name: Upload managed components
uses: actions/upload-artifact@v7
with:
name: sspi-nupkg
path: package/*.nupkg
publish:
name: Publish NuGet package
runs-on: ubuntu-latest
environment: nuget-publish
if: needs.preflight.outputs.dry-run == 'false'
needs:
- preflight
- build-managed
permissions:
id-token: write
steps:
- name: Download NuGet package artifact
uses: actions/download-artifact@v8
with:
name: sspi-nupkg
path: package
- name: NuGet login (OIDC)
uses: NuGet/login@v1
id: nuget-login
with:
user: ${{ secrets.NUGET_BOT_USERNAME }}
- name: Publish to nuget.org
shell: pwsh
run: |
Set-PSDebug -Trace 1
$Files = Get-ChildItem -Recurse package/*.nupkg
foreach ($File in $Files) {
$PushCmd = @(
'dotnet',
'nuget',
'push',
"$File",
'--api-key',
'${{ steps.nuget-login.outputs.NUGET_API_KEY }}',
'--source',
'https://api.nuget.org/v3/index.json',
'--skip-duplicate'
)
Write-Host "Publishing $($File.Name)..."
$PushCmd = $PushCmd -Join ' '
Invoke-Expression $PushCmd
}
package-symbols:
name: Package debug symbols
runs-on: ubuntu-latest
needs: [ preflight, build-native ]
steps:
- name: Download all symbol artifacts
uses: actions/download-artifact@v8
with:
path: artifacts
pattern: sspi-*-release-symbols
- name: Package symbols into zip
shell: pwsh
run: |
Set-PSDebug -Trace 1
$PackageVersion = '${{ needs.preflight.outputs.package-version }}'
$SymbolsDir = "symbols"
New-Item -ItemType Directory -Path $SymbolsDir -Force | Out-Null
# Organize symbols by RID
$SymbolArtifacts = Get-ChildItem -Directory "artifacts" -Filter "sspi-*-release-symbols"
foreach ($Artifact in $SymbolArtifacts) {
# Extract RID from artifact name (e.g., sspi-win-x64-release-symbols -> win-x64)
$Rid = $Artifact.Name -Replace '^sspi-(.+)-release-symbols$', '$1'
$DestDir = Join-Path $SymbolsDir $Rid
New-Item -ItemType Directory -Path $DestDir -Force | Out-Null
# Copy all contents from the artifact
Get-ChildItem -Path $Artifact.FullName -Recurse | ForEach-Object {
if (-not $_.PSIsContainer) {
$RelativePath = $_.FullName.Substring($Artifact.FullName.Length + 1)
$DestPath = Join-Path $DestDir $RelativePath
$DestParent = Split-Path $DestPath -Parent
if (-not (Test-Path $DestParent)) {
New-Item -ItemType Directory -Path $DestParent -Force | Out-Null
}
Copy-Item $_.FullName $DestPath
}
}
}
Write-Host "Symbol directory structure:"
Get-ChildItem -Recurse $SymbolsDir | ForEach-Object { Write-Host $_.FullName }
# Create the zip file
$ZipName = "Devolutions.Sspi.$PackageVersion.symbols.zip"
Compress-Archive -Path "$SymbolsDir/*" -DestinationPath $ZipName -Force
Write-Host "Created symbols archive: $ZipName"
- name: Upload symbols zip
uses: actions/upload-artifact@v7
with:
name: sspi-symbols-zip
path: Devolutions.Sspi.*.symbols.zip
create-release:
name: Create GitHub Release
runs-on: ubuntu-latest
if: needs.preflight.outputs.dry-run == 'false'
needs:
- preflight
- build-managed
- package-symbols
- publish
permissions:
contents: write
steps:
- name: Download NuGet package
uses: actions/download-artifact@v8
with:
name: sspi-nupkg
path: release-assets
- name: Download symbols zip
uses: actions/download-artifact@v8
with:
name: sspi-symbols-zip
path: release-assets
- name: Create GitHub Release
env:
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
shell: pwsh
run: |
Set-PSDebug -Trace 1
$PackageVersion = '${{ needs.preflight.outputs.package-version }}'
$TagName = "v$PackageVersion"
$ReleaseName = "Devolutions.Sspi $PackageVersion"
# Get the list of assets to upload
$Assets = Get-ChildItem -Path "release-assets" -File
Write-Host "Release assets:"
$Assets | ForEach-Object { Write-Host " - $($_.Name)" }
# Build the release notes
$ReleaseNotes = @"
## Devolutions.Sspi $PackageVersion
### NuGet Package
- [Devolutions.Sspi on NuGet.org](https://www.nuget.org/packages/Devolutions.Sspi/$PackageVersion)
### Included Platforms
- Windows (x64, arm64)
- macOS (x64, arm64, universal)
- Linux (x64, arm64)
- iOS device (arm64)
- iOS Simulator (arm64)
- Android (x86, x64, arm, arm64)
### Debug Symbols
The `Devolutions.Sspi.$PackageVersion.symbols.zip` archive contains debug symbols for all platforms:
- Windows: `.pdb` files
- macOS/iOS: `.dSYM` bundles
- Linux/Android: `.debug` or `.dwp` files
"@
# Create the release with assets
$AssetArgs = @()
foreach ($Asset in $Assets) {
$AssetArgs += $Asset.FullName
}
gh release create $TagName `
--title $ReleaseName `
--notes $ReleaseNotes `
--target ${{ github.sha }} `
@AssetArgs
Write-Host "Created release: $ReleaseName with tag $TagName"
notify:
name: Notify failure
runs-on: ubuntu-latest
if: ${{ always() && contains(needs.*.result, 'failure') && github.event_name == 'schedule' }}
needs:
- preflight
- build-native
- build-managed
- package-symbols
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_ARCHITECTURE }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
steps:
- name: Send slack notification
id: slack
uses: slackapi/slack-github-action@v1.26.0
with:
payload: |
{
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*${{ github.repository }}* :fire::fire::fire::fire::fire: \n The scheduled build for *${{ github.repository }}* is <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|broken>"
}
}
]
}
+61
View File
@@ -0,0 +1,61 @@
name: Release crates
permissions:
pull-requests: write
contents: write
on:
workflow_dispatch:
push:
branches:
- master
jobs:
# Create a PR with the new versions and changelog, preparing the next release.
open-pr:
name: Open release PR
environment: cratesio-publish
runs-on: ubuntu-latest
concurrency:
group: release-plz-${{ github.ref }}
cancel-in-progress: false
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
fetch-depth: 512
- name: Run release-plz
id: release-plz
uses: Devolutions/actions-public/release-plz@v1
with:
command: release-pr
git-name: Devolutions Bot
git-email: bot@devolutions.net
github-token: ${{ secrets.DEVOLUTIONSBOT_WRITE_TOKEN }}
# Release unpublished packages.
release:
name: Release crates
environment: cratesio-publish
runs-on: ubuntu-latest
permissions:
id-token: write
contents: write # Required to push the version tag.
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
fetch-depth: 512
- name: Authenticate with crates.io
id: auth
uses: rust-lang/crates-io-auth-action@v1
- name: Run release-plz
uses: Devolutions/actions-public/release-plz@v1
with:
command: release
registry-token: ${{ steps.auth.outputs.token }}