Titano: time-lapse ecosystem (client, server, uploader) — in progress #1

Merged
Alby96 merged 204 commits from claude/keen-knuth-uhxv8w into main 2026-10-02 16:29:53 +02:00
2 changed files with 17 additions and 2 deletions
Showing only changes of commit ee1ba9a4ad - Show all commits

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);
@@ -142,6 +142,19 @@ public sealed class PayloadIntegrityTests(TestContext context)
Assert.Equal(PayloadError.UnsafePath, Assert.Throws<PayloadException>(() => PayloadReader.Open(installer)).Error);
}
[Theory]
[Case("not json at all")]
[Case("{\"formatVersion\":1,\"version\":\"1.0\"}")]
[Case("{\"formatVersion\":1,\"product\":null,\"version\":\"1.0\"}")]
[Case("{\"formatVersion\":2,\"product\":\"Titano\",\"version\":\"1.0\",\"components\":[{\"id\":\"Titano\",\"displayName\":\"Titano\"}]}")]
[Case("{\"formatVersion\":1,\"product\":\"..\",\"version\":\"1.0\",\"components\":[{\"id\":\"Titano\",\"displayName\":\"Titano\"}]}")]
[Case("{\"formatVersion\":1,\"product\":\"Titano\",\"version\":\"1.0\",\"components\":[]}")]
public void MalformedManifestWithMatchingHashIsCorrupt(string json)
{
var installer = _fx.Craft(System.Text.Encoding.UTF8.GetBytes(json), []);
Assert.Equal(PayloadError.Corrupt, Assert.Throws<PayloadException>(() => PayloadReader.Open(installer)).Error);
}
[Test]
public void DeclaredSizeBeyondTheDeflateLimitIsRejectedUpFront()
{