Files
poli0981andClaude Opus 5.5 ec4046c385 chore(deps): require .NET 10.0.14, update Microsoft.Extensions, CsWin32 and CI actions (#28)
.NET 10.0.14 (October 25, 2026) is an out-of-band security release
(CVE-2026-111497 Brotli decoder, re-issued CVE-2026-70197 and
CVE-2026-102870).

- Velopack framework dependency net10-x64-desktop -> net10.0.14-x64-desktop:
  Setup and the in-app updater install the latest .NET 10 Desktop Runtime
  when only an older patch is present (the updater asks first, silent: false).
- Microsoft.Extensions.* 10.0.13 -> 10.0.14, SDK 10.0.401 -> 10.0.403.
- Microsoft.Windows.CsWin32 0.3.363 -> 0.3.367 (build-time only).
- markdownlint-cli2-action v25.0.0, codeql-action/upload-sarif v4.39.1,
  zizmor-action v0.8.0.
- DependencyManifestTests: THIRD_PARTY_NOTICES.md must list exactly the
  app's locked packages at their locked versions, and vpk must match the
  Velopack library.
- README, RELEASING, PRIVACY, notices and release body mention the minimum
  runtime patch.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 10:15:29 +00:00

81 lines
3.7 KiB
C#

// SPDX-License-Identifier: GPL-3.0-or-later
// Copyright (c) CaptureImage Contributors
using System.Text.Json;
using System.Text.RegularExpressions;
using System.Xml.Linq;
using AwesomeAssertions;
using Xunit;
namespace CaptureImage.ViewModels.Tests.Shell;
/// <summary>
/// Dependency upgrades touch more than <c>Directory.Packages.props</c>: the third-party notices
/// (linked from the About page and shipped with the app) must list exactly the packages in the
/// app's lock file at the locked versions, and the <c>vpk</c> tool that packs a release must
/// match the Velopack library inside it.
/// </summary>
public sealed partial class DependencyManifestTests
{
[Fact]
public void ThirdPartyNotices_ListEveryShippedPackageAtItsLockedVersion()
{
var locked = LockedAppPackages();
var listed = PackagesListedInNotices();
locked.Should().NotBeEmpty();
listed.Should().BeEquivalentTo(locked, "docs/legal/THIRD_PARTY_NOTICES.md must follow src/CaptureImage.App/packages.lock.json");
}
[Fact]
public void VelopackLibrary_MatchesTheVpkTool()
{
var root = RepositoryRoot();
var library = XDocument.Load(Path.Combine(root, "Directory.Packages.props")).Descendants("PackageVersion")
.Single(e => (string?)e.Attribute("Include") == "Velopack")
.Attribute("Version")!.Value;
using var manifest = JsonDocument.Parse(File.ReadAllText(Path.Combine(root, ".config", "dotnet-tools.json")));
var tool = manifest.RootElement.GetProperty("tools").GetProperty("vpk").GetProperty("version").GetString();
tool.Should().Be(library, "the release is packed by vpk and updated by the Velopack library, which must agree on the package format");
}
/// <summary>Package id → resolved version for everything the app's publish output contains.</summary>
private static Dictionary<string, string> LockedAppPackages()
{
var path = Path.Combine(RepositoryRoot(), "src", "CaptureImage.App", "packages.lock.json");
using var lockFile = JsonDocument.Parse(File.ReadAllText(path));
// One entry per framework plus one per framework/RID; the RID entry repeats packages with native assets.
var graph = lockFile.RootElement.GetProperty("dependencies").EnumerateObject()
.Single(framework => !framework.Name.Contains('/', StringComparison.Ordinal)).Value;
return graph.EnumerateObject()
.Where(package => package.Value.GetProperty("type").GetString() != "Project")
.ToDictionary(package => package.Name, package => package.Value.GetProperty("resolved").GetString()!, StringComparer.Ordinal);
}
/// <summary>Package id → version from the notices' <c>| Package | Version | License | Project |</c> tables.</summary>
private static Dictionary<string, string> PackagesListedInNotices()
{
var path = Path.Combine(RepositoryRoot(), "docs", "legal", "THIRD_PARTY_NOTICES.md");
return File.ReadLines(path)
.Select(line => PackageRow().Match(line))
.Where(match => match.Success)
.ToDictionary(match => match.Groups["id"].Value, match => match.Groups["version"].Value, StringComparer.Ordinal);
}
private static string RepositoryRoot()
{
for (var dir = new DirectoryInfo(AppContext.BaseDirectory); dir is not null; dir = dir.Parent)
{
if (File.Exists(Path.Combine(dir.FullName, "CaptureImage.sln")))
{
return dir.FullName;
}
}
throw new DirectoryNotFoundException("CaptureImage.sln not found above the test output folder.");
}
[GeneratedRegex(@"^\| (?<id>[A-Za-z0-9][A-Za-z0-9.\-]*) \| (?<version>\d[^ |]*) \|")]
private static partial Regex PackageRow();
}