test(packaging): cover malformed manifests with a valid hash
Invalid JSON, missing or null required fields, an unknown format version, an unsafe product name and an empty component list are all reported as corrupt. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
2 files changed
+17
-2
No files matched your search
@@ -109,10 +109,12 @@ internal sealed class PackagingFixture(TestContext context)
|
||||
BinaryPrimitives.ReadInt32LittleEndian(image.AsSpan(0x3C)) + 4 + 20 + 112 + 4 * 8;
|
||||
|
||||
/// <summary>Assembles an installer by hand from a manifest and data region, bypassing the writer's checks.</summary>
|
||||
public string Craft(PayloadManifest manifest, byte[] data, string name = "crafted.exe")
|
||||
public string Craft(PayloadManifest manifest, byte[] data, string name = "crafted.exe") => Craft(manifest.ToJsonBytes(), data, name);
|
||||
|
||||
/// <summary>Same with raw manifest bytes, which need not be valid JSON; the footer hash always matches them.</summary>
|
||||
public string Craft(byte[] json, byte[] data, string name = "crafted.exe")
|
||||
{
|
||||
var stub = CraftStub;
|
||||
var json = manifest.ToJsonBytes();
|
||||
using var ms = new MemoryStream();
|
||||
ms.Write(stub);
|
||||
ms.Write(json);
|
||||
|
||||
Reference in new issue
Block a user