fix: allow CPU-only release manifests
Heimdall Gitea / Detect CI scope (pull_request) Successful in 37s
Heimdall Gitea / Build and tests (pull_request) Successful in 26m16s
Heimdall Gitea / Build and scan agent image (pull_request) Successful in 9m42s
Heimdall Gitea / Build and scan server image (pull_request) Successful in 10m39s
Heimdall Gitea / Build and scan NVIDIA Agent image (pull_request) Successful in 17m14s
Heimdall Gitea / Publish versioned installer release (pull_request) Skipped
Heimdall Gitea / CI policy (pull_request) Successful in 2s
Heimdall Gitea / Detect CI scope (pull_request) Successful in 37s
Heimdall Gitea / Build and tests (pull_request) Successful in 26m16s
Heimdall Gitea / Build and scan agent image (pull_request) Successful in 9m42s
Heimdall Gitea / Build and scan server image (pull_request) Successful in 10m39s
Heimdall Gitea / Build and scan NVIDIA Agent image (pull_request) Successful in 17m14s
Heimdall Gitea / Publish versioned installer release (pull_request) Skipped
Heimdall Gitea / CI policy (pull_request) Successful in 2s
This commit is contained in:
1 parent
bba04f13c2
commit
fb0b9b887a
4 files changed
+53
-14
No files matched your search
@@ -49,7 +49,7 @@ For an explicitly authorized host validation, inspect existing services and data
|
||||
|
||||
## Acceptance
|
||||
|
||||
Run `bash -n install/install-server.sh`, validate PowerShell syntax when `pwsh` is available, and run `docker compose config --quiet` for both the installer output and `docker/docker-compose.prod.yml`. Exercise a first install and a second run against an isolated temporary directory: confirm secrets and nondefault `.env` values are byte-for-byte unchanged, the old Compose is backed up, missing new variables are added once, and no volume removal command appears. For the Site Install UI, assert generated CPU/GPU Compose and `docker run` references use the corresponding `:latest` Agent image, Compose sets `pull_policy: always`, Docker Run commands set `--pull always`, all paths mount `/var/run/docker.sock`, and the non-root Agent receives the socket group (`DOCKER_GID` in Compose; detected socket GID for Linux `docker run`). Keep signed digest validation for updates dispatched by Central. Then follow `skills/compose-disposable-recipe/SKILL.md` with a unique project, generated credentials, isolated ports/volumes, and an EXIT cleanup trap installed before build/start. Never connect the recipe to a deployed Docker daemon or production data.
|
||||
Run `bash -n install/install-server.sh`, validate PowerShell syntax when `pwsh` is available, and run `docker compose config --quiet` for both the installer output and `docker/docker-compose.prod.yml`. Exercise a first install and a second run against an isolated temporary directory: confirm secrets and nondefault `.env` values are byte-for-byte unchanged, the old Compose is backed up, missing new variables are added once, and no volume removal command appears. For the Site Install UI, assert generated CPU/GPU Compose and `docker run` references use the corresponding `:latest` Agent image, Compose sets `pull_policy: always`, Docker Run commands set `--pull always`, all paths mount `/var/run/docker.sock`, and the non-root Agent receives the socket group (`DOCKER_GID` in Compose; detected socket GID for Linux `docker run`). Keep signed digest validation for updates dispatched by Central. A signed Agent manifest always requires the CPU image repository and digest; GPU image metadata is optional for CPU-only releases, and must be present as a valid repository/digest pair when either field is supplied. Unit tests cover CPU-only and CPU+GPU signed manifests plus a malformed half-pair. Source-built Compose acceptance probes Central's latest-release API against the configured public Forgejo source and verifies the returned signature and required CPU digest; record whether the current release also carries GPU metadata. Then follow `skills/compose-disposable-recipe/SKILL.md` with a unique project, generated credentials, isolated ports/volumes, and an EXIT cleanup trap installed before build/start. Never connect the recipe to a deployed Docker daemon or production data.
|
||||
|
||||
When a runtime Dockerfile changes for OS security updates, source-build and health-check the corresponding Central/Agent image, then scan its saved image archive with the pinned Trivy version and the same `HIGH,CRITICAL` severities used by CI. Record the finding IDs and fixed package versions; do not hide a nonzero scan behind application acceptance.
|
||||
|
||||
|
||||
@@ -91,8 +91,8 @@
|
||||
},
|
||||
"AutoMapper": {
|
||||
"type": "Transitive",
|
||||
"resolved": "16.1.1",
|
||||
"contentHash": "VNEky8JA15ci+oIDRGHITOGOpV4dILsf8pnn24QhDl2urtqgJ2IXiS/V2EtGU17P/+f6OeFQPJETaZXV9QOIZg==",
|
||||
"resolved": "16.3.0",
|
||||
"contentHash": "wFTqA37e1I4AOEhTTYlxrqDE8BQ4OB3dqhlv2KwYmHv+a4tn7R1JW2n2bzXb8eTBhWVBSl7iTZ0VxEt0a57D4w==",
|
||||
"dependencies": {
|
||||
"Microsoft.IdentityModel.JsonWebTokens": "8.14.0"
|
||||
}
|
||||
@@ -326,7 +326,7 @@
|
||||
"heimdall.application": {
|
||||
"type": "Project",
|
||||
"dependencies": {
|
||||
"AutoMapper": "[16.1.1, )",
|
||||
"AutoMapper": "[16.3.0, )",
|
||||
"FluentValidation": "[11.11.0, )",
|
||||
"FluentValidation.DependencyInjectionExtensions": "[11.11.0, )",
|
||||
"Heimdall.Domain": "[1.0.0, )",
|
||||
|
||||
@@ -32,8 +32,10 @@ public static class AgentReleaseManifestVerifier
|
||||
parsed.Assets.Any(asset => string.IsNullOrWhiteSpace(asset.Key) || asset.Value is null || !IsSha256(asset.Value)) ||
|
||||
!IsValidContainerImageRepository(parsed.ContainerImage) ||
|
||||
!IsValidContainerImageDigest(parsed.ContainerImageDigest) ||
|
||||
!IsValidContainerImageRepository(parsed.ContainerImageGpu) ||
|
||||
!IsValidContainerImageDigest(parsed.ContainerImageGpuDigest))
|
||||
((parsed.ContainerImageGpu is null) != (parsed.ContainerImageGpuDigest is null)) ||
|
||||
(parsed.ContainerImageGpu is not null &&
|
||||
(!IsValidContainerImageRepository(parsed.ContainerImageGpu) ||
|
||||
!IsValidContainerImageDigest(parsed.ContainerImageGpuDigest))))
|
||||
return false;
|
||||
|
||||
manifest = parsed;
|
||||
|
||||
@@ -23,6 +23,33 @@ public sealed class AgentReleaseManifestVerifierTests
|
||||
Assert.True(manifest.Assets.ContainsKey("portable"));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TryVerify_AcceptsCpuOnlySignedManifest()
|
||||
{
|
||||
using var key = ECDsa.Create(ECCurve.NamedCurves.nistP256);
|
||||
var bytes = ManifestBytes(includeGpuImage: false);
|
||||
var signature = key.SignData(bytes, HashAlgorithmName.SHA256, DSASignatureFormat.Rfc3279DerSequence);
|
||||
|
||||
var valid = AgentReleaseManifestVerifier.TryVerify(
|
||||
key.ExportSubjectPublicKeyInfoPem(), bytes, signature, "1.0.7", out var manifest);
|
||||
|
||||
Assert.True(valid);
|
||||
Assert.NotNull(manifest);
|
||||
Assert.Null(manifest.ContainerImageGpu);
|
||||
Assert.Null(manifest.ContainerImageGpuDigest);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TryVerify_RejectsIncompleteGpuImageMetadata()
|
||||
{
|
||||
using var key = ECDsa.Create(ECCurve.NamedCurves.nistP256);
|
||||
var bytes = ManifestBytes(invalidGpuPair: true);
|
||||
var signature = key.SignData(bytes, HashAlgorithmName.SHA256, DSASignatureFormat.Rfc3279DerSequence);
|
||||
|
||||
Assert.False(AgentReleaseManifestVerifier.TryVerify(key.ExportSubjectPublicKeyInfoPem(), bytes, signature,
|
||||
"1.0.7", out _));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TryVerify_RejectsModifiedManifest()
|
||||
{
|
||||
@@ -51,13 +78,23 @@ public sealed class AgentReleaseManifestVerifierTests
|
||||
"1.0.7", out _));
|
||||
}
|
||||
|
||||
private static byte[] ManifestBytes(bool invalidArchiveHash = false) => JsonSerializer.SerializeToUtf8Bytes(new
|
||||
private static byte[] ManifestBytes(bool invalidArchiveHash = false, bool includeGpuImage = true,
|
||||
bool invalidGpuPair = false)
|
||||
{
|
||||
version = "1.0.7",
|
||||
assets = new { portable = invalidArchiveHash ? "not-a-sha256" : new string('c', 64) },
|
||||
containerImage = "eltruncho/heimdall-agent",
|
||||
containerImageDigest = "sha256:" + new string('a', 64),
|
||||
containerImageGpu = "eltruncho/heimdall-agent-gpu",
|
||||
containerImageGpuDigest = "sha256:" + new string('b', 64),
|
||||
});
|
||||
var manifest = new Dictionary<string, object?>
|
||||
{
|
||||
["version"] = "1.0.7",
|
||||
["assets"] = new Dictionary<string, string>
|
||||
{
|
||||
["portable"] = invalidArchiveHash ? "not-a-sha256" : new string('c', 64)
|
||||
},
|
||||
["containerImage"] = "eltruncho/heimdall-agent",
|
||||
["containerImageDigest"] = "sha256:" + new string('a', 64),
|
||||
};
|
||||
if (includeGpuImage || invalidGpuPair)
|
||||
manifest["containerImageGpu"] = "eltruncho/heimdall-agent-gpu";
|
||||
if (includeGpuImage && !invalidGpuPair)
|
||||
manifest["containerImageGpuDigest"] = "sha256:" + new string('b', 64);
|
||||
return JsonSerializer.SerializeToUtf8Bytes(manifest);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user