package provider import ( "crypto/sha256" "encoding/hex" "path/filepath" "strings" ) // IsolationTarget describes a synthetic marker verified on the host. It never // carries marker bytes or a credential-file digest. type IsolationTarget struct { Name string `json:"name"` HostPath string `json:"host_path"` Path string `json:"path"` SHA256 string `json:"sha256"` } type IsolationResult struct { Status string `json:"status,omitempty"` Name string `json:"name"` Operations map[string]string `json:"operations"` Safe bool `json:"safe"` } type IsolationReport struct { ProbeNamespaceManifest string `json:"probe_namespace_manifest"` Layer string `json:"layer"` PolicyHash string `json:"policy_hash"` NamespaceManifest string `json:"namespace_manifest"` UID int `json:"uid"` Targets []IsolationResult `json:"targets"` SideDoors map[string]string `json:"side_doors"` Safe bool `json:"safe"` } // ProviderHomeTarget names the staged marker and its fixed aliases, never a source home. func ProviderHomeTarget(name, path string) bool { marker := filepath.Base(path) random, err := hex.DecodeString(strings.TrimPrefix(marker, "equipo-read-")) if err != nil || len(random) != 16 || marker != "equipo-read-"+hex.EncodeToString(random) { return false } return map[string]string{ "selected-home": "/home/runner/" + marker, "proc-root": "/proc/1/root/home/runner/" + marker, "self-root": "/proc/self/root/home/runner/" + marker, "symlink": "/workspace/equipo-direct-sentinel-alias/" + marker, }[name] == path } // ManifestDigest is the lower-case hex SHA-256 the runner records for a // policy manifest, a namespace manifest or a probe marker. func ManifestDigest(raw []byte) string { s := sha256.Sum256(raw) return hex.EncodeToString(s[:]) }