File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -759,6 +759,30 @@ AWFEOF
759759 CLEANUP_CMD=" ${CLEANUP_CMD} ; rm -rf /tmp/awf-lib 2>/dev/null || true"
760760 fi
761761
762+ # Transfer ownership of gh-aw config directories to the chroot user.
763+ # On self-hosted runners these directories are created by the host-side
764+ # gh-aw tooling as root, so the unprivileged chroot user cannot access them.
765+ # We use chown (not chmod a+rwX) to avoid making these dirs world-writable,
766+ # which would be a security risk on multi-user self-hosted runners.
767+ if [ -d /host/tmp/gh-aw ]; then
768+ if chown -R " ${HOST_UID} :${HOST_GID} " /host/tmp/gh-aw 2> /dev/null; then
769+ echo " [entrypoint] Transferred /host/tmp/gh-aw ownership to chroot user (${HOST_UID} :${HOST_GID} )"
770+ else
771+ echo " [entrypoint][WARN] Failed to transfer /host/tmp/gh-aw ownership to chroot user"
772+ fi
773+ fi
774+ # Handle safe-outputs directory (path varies by gh-aw version)
775+ if [ -n " ${GH_AW_SAFE_OUTPUTS:- } " ]; then
776+ _so_dir=" /host$( dirname " $GH_AW_SAFE_OUTPUTS " ) "
777+ if [ -d " $_so_dir " ]; then
778+ if chown -R " ${HOST_UID} :${HOST_GID} " " $_so_dir " 2> /dev/null; then
779+ echo " [entrypoint] Transferred $_so_dir ownership to chroot user (${HOST_UID} :${HOST_GID} )"
780+ else
781+ echo " [entrypoint][WARN] Failed to transfer $_so_dir ownership to chroot user"
782+ fi
783+ fi
784+ fi
785+
762786 # Build LD_PRELOAD command for one-shot token protection
763787 LD_PRELOAD_CMD=" "
764788 if [ -n " ${ONE_SHOT_TOKEN_LIB} " ]; then
You can’t perform that action at this time.
0 commit comments