Files
HomerandClaude Opus 5.5 b52263d0bb Security (S11, S14, S16): the shell's own autocomplete is gone; least privilege in CI; set-up refuses root and another version's release
S11. autocomplete = 'shell' had the shell integration send what was typed
to the engine itself: it could not see a private pane or the AI switch,
and had its own timeout and no chosen model. autocomplete.bash and
autocomplete.zsh are removed, with what exported their switch; the shell
integration keeps its zones and the status record. 'shell' turns nothing
on and is said in the log.

S14. The build job may only read the repository; a job of its own,
for a tag only and after the build passed, downloads the build's artefact
and publishes the release with write access. Every action is pinned by
its commit, with the tag it was taken from beside it.

S16. The set-up program refuses to run as root (everything goes into the
person's own home). A signed SHA256SUMS whose first line names a product
and version must name the release asked for: an older signed release served
under the newest tag is refused. Sums that name nothing yet are still taken,
and that is said. Tests for both, and for the root refusal.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-03 08:07:20 +00:00

185 lines
9.5 KiB
YAML

# LLeMbas TERM's own workflow: the one workflow in this repository that is ours. Every other
# file in this directory is WezTerm's, kept untouched so that merging upstream stays cheap; on
# our repository those are switched off in the Actions settings (llembas/README.md says how).
#
# On every push to main and dev, on a pull request, and by hand: the hygiene check, the LLeMbas
# layer's tests, a release build for Linux x86-64, the config crate's tests, a headless smoke
# test of what was built, the keys pressed in a real window on a display of its own, and the
# packages (kept as a build artefact), installed over the last package of the earlier name.
# On a signed tag vX.Y.Z or vX.Y.Z-beta.N: the same, and then the GitHub Release with the
# packages, SHA256SUMS and the tag message as its notes.
#
# Least privilege: the job that builds can read the repository and nothing else; only the job
# that publishes (tags only, after the build, from the build's own artefact) can write a
# release. Every action is pinned by its commit, the tag it was taken from beside it.
name: llembas-term
on:
push:
# round/**: a branch on which a round of work is built before it is merged into dev
branches: [main, dev, "round/**"]
tags: ["v*"]
pull_request:
workflow_dispatch:
permissions:
contents: read
concurrency:
group: llembas-term-${{ github.ref }}
cancel-in-progress: ${{ !startsWith(github.ref, 'refs/tags/') }}
jobs:
linux:
runs-on: ubuntu-22.04
timeout-minutes: 120
permissions:
contents: read
env:
CARGO_INCREMENTAL: "0"
CARGO_TERM_COLOR: always
steps:
- uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5.1.0
with:
# The whole history: the hygiene check reads what was added since the commit in
# UPSTREAM, and the build derives WezTerm's version from the newest commit.
fetch-depth: 0
# freetype, harfbuzz, libpng and zlib are built from deps/
submodules: recursive
- name: Nothing private in what this fork adds
run: scripts/hygiene.sh
- name: The tag names this version
if: startsWith(github.ref, 'refs/tags/v')
run: |
git fetch --force origin "refs/tags/$GITHUB_REF_NAME:refs/tags/$GITHUB_REF_NAME"
version="$(tr -d '[:space:]' < VERSION)"
[ "v$version" = "$GITHUB_REF_NAME" ] || { echo "VERSION says $version, the tag is $GITHUB_REF_NAME" >&2; exit 1; }
- name: Tools for the checks
run: |
sudo apt-get update
sudo apt-get install -y lua5.4 luajit zsh shellcheck yamllint desktop-file-utils appstream xvfb xdotool
- name: The LLeMbas layer's tests (Lua 5.4 and LuaJIT)
run: scripts/test-lua.sh --all
- name: The shell integration's status record (bash and zsh, each on a terminal of its own)
run: llembas/tests/shell-test.sh
- name: Shell scripts, the workflow, the desktop file
run: |
shellcheck scripts/*.sh llembas/packaging/*.sh llembas/tests/*.sh llembas/ci/*.sh \
llembas/shell/llembas-term.sh llembas/setup/llembas-term-setup
zsh -n llembas/shell/llembas-term.sh
yamllint -d '{extends: default, rules: {line-length: disable, document-start: disable, truthy: disable}}' .github/workflows/llembas-term.yml
desktop-file-validate llembas/packaging/eu.llembas.term.desktop
appstreamcli validate --no-net llembas/packaging/eu.llembas.term.appdata.xml || true
- name: System libraries
run: env CI=yes ./get-deps
- uses: actions-rust-lang/setup-rust-toolchain@166cdcfd11aee3cb47222f9ddb555ce30ddb9659 # v1.17.0
with:
# Upstream's code is not held to "no warnings" here; the action's default would be.
rustflags: ""
- name: The set-up program (what it installs is checked against the release key)
run: llembas/tests/setup-test.sh
- name: Tests of the line logic (the ask line's editor, the input line, history, suggestions, colours)
# first of the Rust steps: it has no dependencies, so a mistake in it is known in a minute
run: llembas/ci/cargo-annotated.sh test --locked -p llembas-line
- name: Build (release)
# also when the line logic's tests failed: one run then says both what they found and
# whether the terminal compiles (the steps after this one still stop at a failure)
if: ${{ !cancelled() }}
# through the wrapper: a compiler error is then an annotation on the run as well
run: llembas/ci/cargo-annotated.sh build --release --locked -p wezterm -p wezterm-gui -p wezterm-mux-server
- name: The binaries carry our names
run: |
ls -l target/release/llembas-term target/release/llembas-term-gui target/release/llembas-term-mux-server
target/release/llembas-term --version
- name: Tests of the configuration crate (where the layer is built in)
run: llembas/ci/cargo-annotated.sh test --release --locked -p config
- name: Smoke test, headless
run: llembas/tests/smoke.sh target/release
- name: Keys pressed in a real window (Xvfb) reach LLeMbas IDE's pane told apart
# Not a gate: a runner without a software OpenGL cannot make the window at all, and
# says so (status 2). What it found is an annotation on the run either way.
continue-on-error: true
run: llembas/tests/keys-gui.sh target/release
- name: Package (.deb and tarball)
run: llembas/packaging/package.sh target dist
- name: The .deb installs, runs and is removed cleanly
run: |
sudo apt-get install -y ./dist/llembas-term_*.deb
llembas-term --version
test ! -e /usr/lib/llembas-term/lembas
llembas-term-setup --dry-run
llembas/tests/smoke.sh /usr/lib/llembas-term
sudo apt-get remove -y llembas-term
test ! -e /usr/bin/llembas-term
- name: The .deb takes the place of the package of the earlier name (llembas-tty 1.0.0-beta.5)
run: |
old=llembas-tty_1.0.0-beta.5_amd64.deb
mkdir -p upgrade
curl -fsSL --retry 3 -o "upgrade/$old" "$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/releases/download/v1.0.0-beta.5/$old"
sudo apt-get install -y "./upgrade/$old"
llembas-tty --version
sudo apt-get install -y ./dist/llembas-term_*.deb
# the old package is gone (at most its /etc/profile.d file is left, until purged) ...
state="$(dpkg-query -W -f='${db:Status-Abbrev}' llembas-tty 2>/dev/null || true)"
case "$state" in ii*) echo "::error title=upgrade::llembas-tty is still installed ($state)"; exit 1 ;; esac
for f in /usr/bin/llembas-tty /usr/bin/llembas-tty-gui /usr/bin/llembas-tty-mux-server /usr/bin/llembas-tty-setup /usr/lib/llembas-tty /usr/share/llembas-tty; do
if [ -e "$f" ]; then echo "::error title=upgrade::$f is still there after the upgrade"; exit 1; fi
done
# ... and the new one is whole and runs
dpkg-query -W -f='${db:Status-Abbrev} ${Package} ${Version}\n' llembas-term
llembas-term --version
llembas-term-mux-server --version
llembas-term-gui --version
llembas-term-setup --dry-run
llembas/tests/smoke.sh /usr/lib/llembas-term
sudo apt-get purge -y llembas-term
sudo dpkg --purge llembas-tty
test ! -e /etc/profile.d/llembas-tty.sh
test ! -e /etc/profile.d/llembas-term.sh
- name: SHA256SUMS
run: |
cd dist
version="$(tr -d '[:space:]' < ../VERSION)"
# Written beside the folder first: inside it, the glob would list SHA256SUMS itself.
{ echo "# llembas-term $version"; sha256sum -- *; } > ../SHA256SUMS
mv ../SHA256SUMS .
cat SHA256SUMS
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: llembas-term-linux-x86_64
path: dist/*
retention-days: 14
release:
# only for a tag, only after everything above passed, and only this job may write
if: startsWith(github.ref, 'refs/tags/v')
needs: linux
runs-on: ubuntu-22.04
timeout-minutes: 15
permissions:
contents: write
steps:
- uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5.1.0
with:
# the tag's message is the release's notes
fetch-depth: 0
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
name: llembas-term-linux-x86_64
path: dist
- name: Publish the GitHub Release
env:
GH_TOKEN: ${{ github.token }}
run: |
git fetch --force origin "refs/tags/$GITHUB_REF_NAME:refs/tags/$GITHUB_REF_NAME"
version="$(tr -d '[:space:]' < VERSION)"
git tag -l --format='%(contents)' "$GITHUB_REF_NAME" | sed '/-----BEGIN SSH SIGNATURE-----/,$d' > notes.md
# A version is released once: a fix is a new version, never the old one re-released.
if gh release view "$GITHUB_REF_NAME" --repo "$GITHUB_REPOSITORY" >/dev/null 2>&1; then
echo "A release for $GITHUB_REF_NAME exists already. Release the fix as a new version." >&2
exit 1
fi
pre=()
case "$version" in *-*) pre=(--prerelease) ;; esac
gh release create "$GITHUB_REF_NAME" --repo "$GITHUB_REPOSITORY" --verify-tag "${pre[@]}" \
--title "LLeMbas TERM $version" --notes-file notes.md dist/*