Skip to content

Commit e174d2c

Browse files
authored
Merge pull request #3943 from buildkite/comment-authless-world-accessible-socket
chore: Add comments rationalising authless world-accessible socket
2 parents bc775fe + 366e063 commit e174d2c

1 file changed

Lines changed: 16 additions & 1 deletion

File tree

kubernetes/runner.go

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,15 @@ func (r *Runner) Run(ctx context.Context) error {
8888
r.mux.Handle(rpc.DefaultRPCPath, r.server)
8989

9090
// Set umask to 0, so the socket is created with mode 0o777 (world
91-
// read-write-executable)
91+
// read-write-executable).
92+
// The other containers may be running under any arbitrary uid/gid, and
93+
// the socket needs to be accessible to them.
94+
// This is acceptable because the security boundary of the job is
95+
// considered to be _the pod_. The socket is exposed by us only within
96+
// the pod.
97+
// Note that with or without accessing the socket, a rogue container or
98+
// process within the pod can do all sorts of things to disrupt the
99+
// normal operation of the job.
92100
oldUmask, err := Umask(0)
93101
if err != nil {
94102
return fmt.Errorf("failed to set socket umask: %w", err)
@@ -313,6 +321,13 @@ type ExitCode struct {
313321
// contains the env vars that would normally be in the environment of the
314322
// bootstrap subcommand, particularly, the agent session token.
315323
func (r *Runner) Register(id int, reply *RegisterResponse) error {
324+
// Note that there is no authentication of the client.
325+
// This is acceptable because the security boundary of the job is
326+
// considered to be _the pod_. The socket is exposed by us only within
327+
// the pod.
328+
// Note that with or without accessing the socket, a rogue container or
329+
// process within the pod can do all sorts of things to disrupt the
330+
// normal operation of the job.
316331
if id < 0 || id >= len(r.clients) {
317332
return fmt.Errorf("unrecognized client id: %d", id)
318333
}

0 commit comments

Comments
 (0)