From 1d9e8d68247f9b1f64a010dd04ff2b246b36e31c Mon Sep 17 00:00:00 2001 From: jochen Date: Mon, 23 Nov 2026 12:02:32 +0100 Subject: [PATCH] gitea runs as its own account, so the vault gives it its own secret gitea asks the vault for module/gitea/* from inside the machine's tool runner, whose calls are named .node-tools, and the vault refuses that account: every gitea tool and the seat git's merge-pull failed. Its manifest now declares runs-as gitea, the user resource gitea (in the group docker, which the seat git's note verb needs for docker exec into the forge's container), secrets-owner gitea and the own secret broker, so the node-engine composes a runtime of its own for it on the account .gitea. Builds: design 47 H2 H-A-543, H-A-545 (1) --- modules/gitea/module.json | 15 +++++++++++++++ modules/gitea/test/delivery.test.ts | 5 +++++ 2 files changed, 20 insertions(+) diff --git a/modules/gitea/module.json b/modules/gitea/module.json index 35d4a05f6..1456d59a6 100644 --- a/modules/gitea/module.json +++ b/modules/gitea/module.json @@ -6,6 +6,7 @@ "check-needs": [ "node-build-node" ], + "runs-as": "gitea", "requires": [ "postgres-database", "route", @@ -39,6 +40,10 @@ "admin": "${dir:state}/admin.secret" } }, + "own-secrets": { + "broker": "${dir:state}/broker" + }, + "secrets-owner": "gitea", "capabilities": [ "container-runtime" ], @@ -271,6 +276,16 @@ } }, "resources": [ + { + "id": "account", + "type": "user", + "name": "gitea", + "shell": "/usr/bin/nologin", + "home": "/var/lib/gitea", + "groups": [ + "docker" + ] + }, { "id": "mesh-state", "type": "directory", diff --git a/modules/gitea/test/delivery.test.ts b/modules/gitea/test/delivery.test.ts index b134f8696..2a097c071 100644 --- a/modules/gitea/test/delivery.test.ts +++ b/modules/gitea/test/delivery.test.ts @@ -28,6 +28,11 @@ test("a note line is appended once, as the forge's user, in its own repository", { added: true, lines: 2 }); const append = calls.find((c) => c.includes("append"))!; assert.deepEqual(append.slice(0, 7), ["docker", "exec", "-u", "git", "gitea", "git", "--git-dir"]); + // The note is run by docker, so the account the module runs as is in the group docker (H-A-543, H-A-545). + const { readFileSync } = await import("node:fs"); + const manifest = JSON.parse(readFileSync(new URL("../module.json", import.meta.url), "utf8")); + const account = manifest.resources.find((r: { type: string; name: string }) => r.type === "user" && r.name === manifest["runs-as"]); + assert.ok(account?.groups?.includes("docker"), `the account ${manifest["runs-as"]} the module runs as is not in the group docker`); assert.equal(append[7], "/data/git/repositories/novox/mesh-catalog.git"); assert.ok(append.includes("--ref=mesh-plan")); assert.throws(() => noteArgs("gitea", "novox", "x; rm -rf /", sha, "mesh-plan"), /not a repository/);