Skip to content

Commit f726339

Browse files
feat: SELinux lables for --bind (#906)
1 parent 6ebcac3 commit f726339

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

go.mod

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ require (
2929
github.com/moby/buildkit v0.9.2
3030
github.com/opencontainers/image-spec v1.0.1
3131
github.com/opencontainers/runc v1.0.2 // indirect
32+
github.com/opencontainers/selinux v1.10.0
3233
github.com/pkg/errors v0.9.1
3334
github.com/robertkrimen/otto v0.0.0-20210614181706-373ff5438452
3435
github.com/sabhiram/go-gitignore v0.0.0-20201211210132-54b8a0bf510f

go.sum

+2
Original file line numberDiff line numberDiff line change
@@ -956,6 +956,8 @@ github.com/opencontainers/runtime-tools v0.0.0-20181011054405-1d69bd0f9c39/go.mo
956956
github.com/opencontainers/selinux v1.6.0/go.mod h1:VVGKuOLlE7v4PJyT6h7mNWvq1rzqiriPsEqVhc+svHE=
957957
github.com/opencontainers/selinux v1.8.0/go.mod h1:RScLhm78qiWa2gbVCcGkC7tCGdgk3ogry1nUQF8Evvo=
958958
github.com/opencontainers/selinux v1.8.2/go.mod h1:MUIHuUEvKB1wtJjQdOyYRgOnLD2xAPP8dBsCoU0KuF8=
959+
github.com/opencontainers/selinux v1.10.0 h1:rAiKF8hTcgLI3w0DHm6i0ylVVcOrlgR1kK99DRLDhyU=
960+
github.com/opencontainers/selinux v1.10.0/go.mod h1:2i0OySw99QjzBBQByd1Gr9gSjvuho1lHsJxIJ3gGbJI=
959961
github.com/opentracing-contrib/go-stdlib v1.0.0/go.mod h1:qtI1ogk+2JhVPIXVc6q+NHziSmy2W5GbdQZFUHADCBU=
960962
github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o=
961963
github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc=

pkg/runner/run_context.go

+5
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ import (
1717
"github.com/mitchellh/go-homedir"
1818
log "github.com/sirupsen/logrus"
1919

20+
selinux "github.com/opencontainers/selinux/go-selinux"
21+
2022
"github.com/nektos/act/pkg/common"
2123
"github.com/nektos/act/pkg/container"
2224
"github.com/nektos/act/pkg/model"
@@ -90,6 +92,9 @@ func (rc *RunContext) GetBindsAndMounts() ([]string, map[string]string) {
9092
if runtime.GOOS == "darwin" {
9193
bindModifiers = ":delegated"
9294
}
95+
if selinux.GetEnabled() {
96+
bindModifiers = ":z"
97+
}
9398
binds = append(binds, fmt.Sprintf("%s:%s%s", rc.Config.Workdir, rc.Config.ContainerWorkdir(), bindModifiers))
9499
} else {
95100
mounts[name] = rc.Config.ContainerWorkdir()

0 commit comments

Comments
 (0)