feat: publish verifiable proxyctl v1

This commit is contained in:
proxyctl coordinator
2026-07-17 09:54:08 +08:00
parent 5ec2b1dae1
commit 2b161e86e6
11 changed files with 536 additions and 28 deletions
+41
View File
@@ -0,0 +1,41 @@
//go:build proxyctl_process_test
package main
import (
"errors"
"os"
"os/user"
"strconv"
"proxyctl/internal/profile"
"proxyctl/internal/target"
)
// This file is compiled only into the process-smoke binary. It gives that real
// executable an identity whose home is inside the test sandbox and omits
// production system Targets, so no command can reach developer or host state.
func init() {
processProductionTargets = func(profile.IdentityEnvironment) ([]target.Target, error) {
return []target.Target{}, nil
}
processCurrentUser = func() (profile.UserIdentity, error) {
home := os.Getenv("PROXYCTL_PROCESS_TEST_HOME")
if home == "" {
return profile.UserIdentity{}, errors.New("PROXYCTL_PROCESS_TEST_HOME is required by proxyctl_process_test builds")
}
current, err := user.Current()
if err != nil {
return profile.UserIdentity{}, err
}
uid, err := strconv.Atoi(current.Uid)
if err != nil {
return profile.UserIdentity{}, err
}
gid, err := strconv.Atoi(current.Gid)
if err != nil {
return profile.UserIdentity{}, err
}
return profile.UserIdentity{Username: current.Username, HomeDir: home, UID: uid, GID: gid}, nil
}
}