getsops / getsops/sops

exec-env/exec-file signal handling might be broken

Open
#840 1 comment 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug help wanted
Dominant language
Go
Stars
23.1k
Forks
1.1k
Avg merge
1d 11h
Merged PRs (30d)
9

Description

Hey folks,

We've encountered some issues after we started using exec-file for our software. For example, py.test being run with exec-file inside a docker container would terminate on sigterm immediately, whereas normally it prints test failures first, which is quite annoying.

I'm sorry that I can't provide a minimal reproducing case as we just started exporting secrets before running our process "naked", which solved those problems for us, but after looking through the sources my theory to why that's happening is as follows:

…which sounds similar to the problem someone was having in this blog post https://bigkevmcd.github.io/go/pgrp/context/2019/02/19/terminating-processes-in-go.html

If my understanding is correct, it's a subtle problem for a lot of software using sops. The solution would be for sops to spawn subprocess into a separate process group and pass signals on manually, waiting for the process to finish.

Thank your for your awesome piece of software!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with cmd/sops/subcommand/exec/exec_unix.go, the subprocess entry point referenced in the report, and compare exec-file behavior with the Docker and py.test signal scenario described. Reproduce the termination sequence if possible; done means the child process can finish and its output is preserved when the container receives SIGTERM or SIGHUP.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, go
Domain
cli, devops, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.