gitea: the patch spool is read by the module's own account

Review round 1: since gitea runs as its own account, the tools no longer run as
the machine's account that owns the forge-patches directory; they read and
remove the named file as any other account may.

Builds: design 47 H2 H-A-543
This commit is contained in:
2026-11-25 17:02:17 +01:00
parent 1d9e8d6824
commit f282a74e59
2 changed files with 4 additions and 3 deletions
+3 -2
View File
@@ -72,8 +72,9 @@ Approve names.
**A patch too large to type** (novox/hq issue 852: a feature's diff is megabytes) goes as `patch_file`, with
`patch_sha256`. The caller writes the patch into the module's spool directory `forge-patches`
(`/var/lib/mesh/forge-patches`, mode 0733 and owned by the machine's account, which the tools run as: anyone writes,
nobody lists; the bundle is given its path as `MESH_GITEA_PATCH_DIR`) and names it: `patch_file` is the file's NAME,
(`/var/lib/mesh/forge-patches`, mode 0733 and owned by the machine's account: anyone writes, nobody lists, and the
tools, which run as the module's own account gitea, read and remove the named file as any other account may; the bundle
is given its path as `MESH_GITEA_PATCH_DIR`) and names it: `patch_file` is the file's NAME,
32 to 64 characters of `0-9a-f` that the caller chooses at random, never a path. The tool then reads that one file,
applies it exactly as it applies `patch` (same size limit, same answer) and removes it once it has found it, whether
the commit was made or not. A file refused before that (a bad name, a missing hash or spool directory, a name with no
+1 -1
View File
@@ -15,7 +15,7 @@ import (
// A patch too large to type into a call is handed over as a file (novox/hq issue 852). The caller writes it into
// one spool directory the module declares (mode 0733: anyone writes, nobody lists) and names it in patch_file,
// with the file's SHA-256. The tool runs as the machine's account, so it reads nothing but that directory: the
// with the file's SHA-256. The tool runs as the module's own account gitea, and reads nothing but that directory: the
// name is 32 to 64 characters of [0-9a-f], so it holds no separator and no dot; the file must be a regular file
// (never a symlink); and its hash must be the caller's, because without the sticky bit another writer could have
// replaced it. The file is removed once taken, whether the commit was made or not.