mirror of
https://github.com/Buriburizaem0n/nezha_domains.git
synced 2026-09-20 10:10:13 +00:00
fix(agentcompat): secure credentialed agent workspaces
Co-authored-by: naiba/CloudCode <hi+cloudcode@nai.ba>
This commit is contained in:
@@ -22,6 +22,8 @@ func TestPreparedBinary_EightIndependentAgentsShareBinaryAndCleanUp(t *testing.T
|
||||
preparedRoot := prepared.WorkspaceRoot()
|
||||
binaryPath := prepared.BinaryPath()
|
||||
require.FileExists(t, binaryPath)
|
||||
requireDirectoryMode(t, preparedRoot, 0o711)
|
||||
requireDirectoryMode(t, filepath.Dir(binaryPath), 0o711)
|
||||
initialBinaryInfo, err := os.Stat(binaryPath)
|
||||
require.NoError(t, err)
|
||||
initialBinaryStat, ok := initialBinaryInfo.Sys().(*syscall.Stat_t)
|
||||
@@ -110,6 +112,13 @@ func TestPreparedBinary_EightIndependentAgentsShareBinaryAndCleanUp(t *testing.T
|
||||
require.ErrorIs(t, statErr, os.ErrNotExist)
|
||||
}
|
||||
|
||||
func requireDirectoryMode(t *testing.T, path string, want os.FileMode) {
|
||||
t.Helper()
|
||||
info, err := os.Stat(path)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, want, info.Mode().Perm())
|
||||
}
|
||||
|
||||
func TestAgent_StartBuildsAndOwnsItsBinary(t *testing.T) {
|
||||
instance, err := Start(t.Context(), AgentStartConfig{
|
||||
SourceDir: testAgentSourceDir(t),
|
||||
|
||||
Reference in New Issue
Block a user