From 426ea638aebc8dbc8726e003d5ca6dabbd0df980 Mon Sep 17 00:00:00 2001 From: deepend Date: Thu, 22 Oct 2026 18:55:21 -0600 Subject: [PATCH] Harden script approvals and add migration support --- .github/workflows/test.yml | 15 + Makefile | 23 +- README.md | 134 +++++- tests/integration.sh | 100 +++++ tests/smoke.sh | 15 + tilde | 892 ++++++++++++++++++++++++++----------- tilde.1 | 123 ++--- 7 files changed, 963 insertions(+), 339 deletions(-) create mode 100644 .github/workflows/test.yml create mode 100755 tests/integration.sh create mode 100755 tests/smoke.sh diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..30ccc38 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,15 @@ +name: Tests + +on: + push: + pull_request: + +jobs: + shell: + runs-on: ubuntu-24.04 + steps: + - uses: actions/checkout@v4 + - name: Shell syntax and smoke tests + run: sh tests/smoke.sh + - name: Approval and migration integration tests + run: sudo sh tests/integration.sh diff --git a/Makefile b/Makefile index c8e0265..650460a 100644 --- a/Makefile +++ b/Makefile @@ -4,20 +4,17 @@ BINDIR ?= $(PREFIX)/bin MANDIR ?= $(PREFIX)/share/man install: - @echo Installing the executable to $(BINDIR) - @mkdir -p $(BINDIR) - @cp -f $(BASENAME) $(BINDIR)/$(BASENAME) - @chmod 755 $(BINDIR)/$(BASENAME) - @echo Installing the manual page to $(MANDIR)/man1 - @mkdir -p $(MANDIR)/man1 - @cp -f $(BASENAME).1 $(MANDIR)/man1/$(BASENAME).1 - @chmod 644 $(MANDIR)/man1/$(BASENAME).1 + @set -eu; \ + mkdir -p "$(BINDIR)" "$(MANDIR)/man1"; \ + install -m 0755 "$(BASENAME)" "$(BINDIR)/.$(BASENAME).new"; \ + mv -f "$(BINDIR)/.$(BASENAME).new" "$(BINDIR)/$(BASENAME)"; \ + install -m 0644 "$(BASENAME).1" "$(MANDIR)/man1/.$(BASENAME).1.new"; \ + mv -f "$(MANDIR)/man1/.$(BASENAME).1.new" "$(MANDIR)/man1/$(BASENAME).1" uninstall: - @echo Removing the executable from $(BINDIR) - @rm -f $(BINDIR)/$(BASENAME) - @echo Removing the manual page from $(MANDIR)/man1 - @rm -f $(BINDIR)/man1/$(BASENAME).1 + @rm -f "$(BINDIR)/$(BASENAME)" "$(MANDIR)/man1/$(BASENAME).1" -.PHONY: install uninstall +test: + @sh tests/smoke.sh +.PHONY: install uninstall test diff --git a/README.md b/README.md index 831cdd7..93444e5 100644 --- a/README.md +++ b/README.md @@ -1,25 +1,123 @@ -# `tilde` - user script tilde-launcher +# tilde launcher -``` -Usage: tilde [options] [command] +`tilde` is a small POSIX shell utility for submitting and approving programs +that can be run by other users. Approved commands remain available under +`/tilde/bin`. This version targets Linux with GNU coreutils, `runuser`, +`timeout`, `flock`, `getent`, `sha256sum`, and a sendmail-compatible MTA. -Options: - -h, --help Show this help message and exit - -v, --version Show version information +## Commands -Commands: - list Show a list of approved user scripts - submit Start the submission flow for your own script - about