carlos / platform Public

Clone
git clone https://amadan.net/carlos/platform

Plain git — no account needed to clone.

Download

Download this file

1package host
2
3import "github.com/carlosframework/platform/internal/release"
4
5// pointerRatchet is #253's ratchet for this process (spec §4.6), the one
6// SharedDigestRatchet keeps, so a fresh call per pass is the same object.
7// Root writes its marks under /opt (root-owned); the agent, sandboxed out of
8// /opt, writes under its data dir. Each reads both, so a mark either side
9// wrote protects the whole box. CARLOS_REQUIRE_POINTER_DIGEST applies to both.
10func pointerRatchet(root bool, optDir, dataDir string, getenv func(string) string) *release.DigestRatchet {
11 rootDir, edgeDir := release.RootRatchetDir(optDir), release.EdgeRatchetDir(dataDir)
12 require := release.RequirePointerDigest(getenv)
13 if root {
14 return release.SharedDigestRatchet(rootDir, []string{edgeDir}, require)
15 }
16 return release.SharedDigestRatchet(edgeDir, []string{rootDir}, require)
17}
18