Summary
The Copilot CLI install script (actions/setup/sh/install_copilot_cli.sh) unconditionally uses sudo to install to /usr/local/bin. This forces ARC/DinD operators to allow privilege escalation in their runner pods, which conflicts with Kubernetes PodSecurity policies that enforce allowPrivilegeEscalation: false.
The AWF install script (install_awf_binary.sh) already solves this with a --rootless flag that installs to ~/.local/bin and ~/.local/lib/ without sudo. The Copilot CLI install could adopt a similar pattern.
Current sudo usage in install_copilot_cli.sh
| Line |
Command |
Purpose |
| 44 |
sudo chown -R "$(id -u):$(id -g)" "$COPILOT_DIR" |
Fix ownership of .copilot dir created by chroot |
| 53 |
sudo find /tmp -maxdepth 1 -name 'awf-*-chroot-home' ... |
Clean up stale chroot home dirs |
| 455 |
sudo install -m 0755 "$wrapper_path" "${INSTALL_DIR}/copilot" |
Install wrapper script to /usr/local/bin |
| 547 |
sudo tar -xz -C "${INSTALL_DIR}" -f ... |
Extract binary to /usr/local/bin |
| 548 |
sudo chmod +x "${INSTALL_DIR}/copilot" |
Make binary executable |
Proposed approach
Follow the install_awf_binary.sh pattern:
- Accept a
--rootless flag
- When rootless, set
INSTALL_DIR="${HOME}/.local/bin" instead of /usr/local/bin
- Replace
sudo calls with a maybe_sudo wrapper that skips sudo in rootless mode
- Append
$INSTALL_DIR to $GITHUB_PATH so subsequent steps find the binary
- The
chown and find cleanup calls may not need sudo at all in rootless mode since the files would be owned by the runner user
Impact
This would allow ARC/DinD runners to enforce allowPrivilegeEscalation: false in their pod security context, removing the last known limitation for ARC/DinD deployments documented in the setup guide.
Related
Summary
The Copilot CLI install script (
actions/setup/sh/install_copilot_cli.sh) unconditionally usessudoto install to/usr/local/bin. This forces ARC/DinD operators to allow privilege escalation in their runner pods, which conflicts with Kubernetes PodSecurity policies that enforceallowPrivilegeEscalation: false.The AWF install script (
install_awf_binary.sh) already solves this with a--rootlessflag that installs to~/.local/binand~/.local/lib/withoutsudo. The Copilot CLI install could adopt a similar pattern.Current
sudousage ininstall_copilot_cli.shsudo chown -R "$(id -u):$(id -g)" "$COPILOT_DIR".copilotdir created by chrootsudo find /tmp -maxdepth 1 -name 'awf-*-chroot-home' ...sudo install -m 0755 "$wrapper_path" "${INSTALL_DIR}/copilot"/usr/local/binsudo tar -xz -C "${INSTALL_DIR}" -f .../usr/local/binsudo chmod +x "${INSTALL_DIR}/copilot"Proposed approach
Follow the
install_awf_binary.shpattern:--rootlessflagINSTALL_DIR="${HOME}/.local/bin"instead of/usr/local/binsudocalls with amaybe_sudowrapper that skipssudoin rootless mode$INSTALL_DIRto$GITHUB_PATHso subsequent steps find the binarychownandfindcleanup calls may not needsudoat all in rootless mode since the files would be owned by the runner userImpact
This would allow ARC/DinD runners to enforce
allowPrivilegeEscalation: falsein their pod security context, removing the last known limitation for ARC/DinD deployments documented in the setup guide.Related
allowPrivilegeEscalation: falseknown limitation indocs/src/content/docs/guides/arc-dind-copilot-agent.md