fix(agentcompat): secure credentialed agent workspaces

Co-authored-by: naiba/CloudCode <hi+cloudcode@nai.ba>
This commit is contained in:
naiba
2026-07-20 17:02:37 +00:00
co-authored by naiba/CloudCode
parent c7799854b9
commit 454c577968
3 changed files with 36 additions and 4 deletions
@@ -55,7 +55,7 @@ func closePreparedWorkspace(workspaceRoot *workspace.Workspace, cause error) err
func exposePreparedBinary(root, binaryPath string) error {
for _, path := range []string{root, filepath.Dir(binaryPath)} {
if err := os.Chmod(path, 0o755); err != nil {
if err := os.Chmod(path, 0o711); err != nil { // #nosec G302 -- Directories need search permission for the credentialed test agent without granting directory reads; payloads and logs remain private.
return fmt.Errorf("make prepared agent binary executable: %w", err)
}
}