Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,15 @@ falling back from a release that does not come up.
every digest for `url-file` sources only; a `regular-file` source is written unchecked. A stick
is read as `file:///run/construct/update`, the CDN as https. Transfers are generated
(`cmd/image/transfers.go`), never hand-written.
- **Super with a letter is one table**, `usr/share/construct/keys.json`: keyd (`etc/keyd/default.conf`,
held to the table by `go test ./cmd/image`) swallows Super and sends copy, paste and cut as the
Insert chords every application takes, and each other letter as F13 to F24, which xkb knows as
such only through `etc/xkb/rules/evdev` (xkeyboard-config's `fkeys(basic_13-24)` under every
layout and option); the shell's `keys` extension turns those into the chord the focused
application binds (Ctrl, or Ctrl+Shift in a terminal), and `construct-keys` (Super+K) shows the
table. keyd sees no window and the shell cannot send a chord cleanly while Super is held, which
is why the two share the work; keyd's socket stays closed to the session (recipes/keyd).
`task test` presses the letters in windows posing as Files and as Ghostty.
- **Nothing reaches the machine that it did not ask for.** The firewall
(`usr/lib/construct/firewall.nft`, before any network) drops what comes in but replies, what
IPv4/IPv6, DHCP and mDNS need, the containers' bridges, Tailscale, and SSH when a person turned it
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,12 @@ of a forgotten password. Take the stick out and restart.
`/var` anew (every person, file, container and setting gone; the system slots untouched) and
GNOME's Initial Setup asks who it is for. The disk still opens with the password it was installed
with: to hand the machine to someone else, install it again from the stick.
- **Super with a letter, the same everywhere.** Super+C, V and X copy, paste and cut in every
application and in a terminal, where Ctrl+C would interrupt; Super+T, W, N, F, A, Z, S, P, Q,
R, L and O do what Ctrl with the letter does in most applications and what Ctrl+Shift with it
does in a terminal, so a terminal's own Ctrl+R, L and P stay its. Super alone is the overview,
Super+number the dock, Super+M the notifications, and Super+K shows the whole table, per
application (*Keyboard Shortcuts* in the app grid). Ctrl keeps working as before.
- **Firmware the image cannot carry.** A few parts boot only their maker's firmware, licensed to
the machine's owner and to nobody else: the ThinkPad X9-15p's sensor hub (ambient light,
rotation, presence) and the tuning of its four speakers are in Lenovo's Windows driver packages
Expand Down
22 changes: 0 additions & 22 deletions build/grype.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,28 +17,6 @@ check-for-app-update: false
# party can rebuild: kept here, listed by the report with what nobody has fixed, until a release
# of theirs built after the fix. Each rule names the file, the vulnerability and the reason.
ignore:
# vsce-sign, the .NET binary VS Code bundles to check an extension's signature as it installs,
# embeds System.Security.Cryptography.Pkcs 9.0.5: CVE-2026-84008's quadratic CPU use in
# SignedCms.CheckSignature over X.509 data the signature carries (2026-10-13, fixed in 9.0.21),
# and GHSA-2fmv-rv2c-59x7 beside it. Microsoft's @vscode/vsce-sign was last released 2.1.0 on
# 2026-08-17, so no VS Code fixes it; the exposure is the CPU of a signature check on an
# extension a person installs. Drop the rules when a VS Code ships a vsce-sign built after
# 2026-10-13 (strings vsce-sign | grep '^9\.0\.' says its runtime). The rules name the assembly,
# its version and type, not the file: the watch scans the release's SBOM, which records no
# location for an assembly a binary embeds, and a rule with one never applied there (issue #17).
- vulnerability: GHSA-846f-f764-76mx
reason: "only Microsoft can rebuild VS Code's vsce-sign; no VS Code release carries one built after the fix"
package:
name: System.Security.Cryptography.Pkcs
version: 9.0.5
type: dotnet
- vulnerability: GHSA-2fmv-rv2c-59x7
reason: "only Microsoft can rebuild VS Code's vsce-sign; no VS Code release carries one built after the fix"
package:
name: System.Security.Cryptography.Pkcs
version: 9.0.5
type: dotnet

# A fix a recipe carries from its upstream's branch at a version Wolfi's feed does not know:
# the feed names the Wolfi build that fixed it, and a recipe below that build is flagged though
# it holds the same fix. Each rule names the recipe's build, so it lapses at the next one.
Expand Down
4 changes: 2 additions & 2 deletions build/host.env
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ TASK_VERSION=3.54.0
TASK_SHA256=680859dbb4d881a9c72d4d9a8f510825450849af8567deacd7302c01124416fb

# gh, which publishes a release, from its GitHub release.
GH_VERSION=2.104.0
GH_SHA256=98cb101ad87dbbd3f6b2f2bfcbd43197ccd07643140121d8a9cfaa91eadbc24e
GH_VERSION=2.106.0
GH_SHA256=a476449fa9625413c54a3734eded62e9e480e49f421ff08e7f3b3879c059a033

# What the harness runs on the host, from the distribution: the UEFI firmware its machines boot
# (OVMF, Secure Boot's build), mtools to forge sticks (the lifecycle), dosfstools for the stick
Expand Down
8 changes: 4 additions & 4 deletions build/versions.env
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ WOLFI_BASE_IMAGE=cgr.dev/chainguard/wolfi-base:latest@sha256:88a20e2d017bd20cdc0

# The kernel, from kernel.org. A new series can fail the fragments' assertions; Arch's base config
# (kernel/Dockerfile) is pinned to the same version, or Arch's newest while it has none for this one.
KERNEL_VERSION=7.3.4
KERNEL_SHA256=b11b6df8295e8e991ff040b71aaa4994a8b55caa23b6b092907f195b5840fd1f
KERNEL_VERSION=7.3.7
KERNEL_SHA256=c4cbb90c12f90d59e49320b9ab0b5e7b7de0c15dd56ede5bc0c81ba16b30e59d

# Firmware (firmware/Dockerfile): linux-firmware's release, and Intel's microcode from its own.
LINUX_FIRMWARE_VERSION=20261019
LINUX_FIRMWARE_SHA256=a10d1ab5baf2c74ba92e8c7cf313e691696c26bddfa6df00db795e48d70cd4ca
LINUX_FIRMWARE_VERSION=20261124
LINUX_FIRMWARE_SHA256=2cabe10253005f55bf4bbc0ebb25c0964d66f7c4121ffa47853ff1e70ea1aa54
INTEL_MICROCODE_VERSION=microcode-20261110
INTEL_MICROCODE_SHA256=989a5cd345808babee491da69ed80ae5741697bc87743a71d0ba611f3fd6afa5

Expand Down
132 changes: 132 additions & 0 deletions cmd/image/keybinds.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
package main

import (
"encoding/json"
"fmt"
"os"
"regexp"
"sort"
"strings"
)

// keysTable is usr/share/construct/keys.json: Super with a letter, the same in every application,
// as keyd and the shell's keys extension do it between them (etc/keyd/default.conf says how). Its
// readers are the extension and construct-keys; here it is checked against keyd's file.
type keysTable struct {
Everywhere []keyEntry `json:"everywhere"`
Default []keyEntry `json:"default"`
Apps map[string]keysForApp `json:"apps"`
Shell []keyEntry `json:"shell"`
}

type keysForApp struct {
Name string `json:"name"`
Keys []keyEntry `json:"keys"`
}

type keyEntry struct {
Key string `json:"key"`
Plain string `json:"plain"`
Does string `json:"does"`
Sends string `json:"sends"`
}

func readKeysTable(path string) (keysTable, error) {
var t keysTable
b, err := os.ReadFile(path)
if err != nil {
return t, err
}
if err := json.Unmarshal(b, &t); err != nil {
return t, fmt.Errorf("%s: %w", path, err)
}
return t, nil
}

// keydLines are the bindings keyd's file must hold for the table: the Insert chords of what
// works everywhere, and the plain key of each default letter, in keyd's own spelling.
func (t keysTable) keydLines() ([]string, error) {
var lines []string
for _, e := range t.Everywhere {
chord, err := keydChord(e.Sends)
if err != nil {
return nil, err
}
lines = append(lines, e.Key+" = "+chord)
}
for _, e := range t.Default {
if e.Plain == "" {
return nil, fmt.Errorf("default %s: no plain key for keyd to send", e.Key)
}
lines = append(lines, e.Key+" = "+strings.ToLower(e.Plain))
}
return lines, nil
}

var chordPart = regexp.MustCompile(`<(Control|Shift|Alt)>`)

// keydChord spells a GTK accelerator ("<Control>Insert") as keyd does ("C-insert").
func keydChord(accel string) (string, error) {
mods := ""
for _, m := range chordPart.FindAllStringSubmatch(accel, -1) {
mods += map[string]string{"Control": "C-", "Shift": "S-", "Alt": "A-"}[m[1]]
}
key := chordPart.ReplaceAllString(accel, "")
if key == "" || strings.ContainsAny(key, "<>") {
return "", fmt.Errorf("%q is no accelerator", accel)
}
return mods + strings.ToLower(key), nil
}

// keydBindings are the bindings a keyd file's [meta] layer holds.
func keydBindings(conf string) []string {
var lines []string
in := false
for _, l := range strings.Split(conf, "\n") {
l = strings.TrimSpace(l)
switch {
case strings.HasPrefix(l, "["):
in = l == "[meta]"
case in && l != "" && !strings.HasPrefix(l, "#"):
lines = append(lines, l)
}
}
return lines
}

// appKeysCovered is the letters an app's table leaves to the default: every app entry must name a
// default letter, so that the extension never has a letter keyd sends and no chord for it.
func (t keysTable) check() error {
defaults := map[string]bool{}
plains := map[string]bool{}
for _, e := range t.Default {
defaults[e.Key] = true
if plains[e.Plain] {
return fmt.Errorf("default %s: %s is another letter's plain key too", e.Key, e.Plain)
}
plains[e.Plain] = true
}
for _, e := range t.Everywhere {
if defaults[e.Key] {
return fmt.Errorf("%s is everywhere's and default's", e.Key)
}
}
apps := make([]string, 0, len(t.Apps))
for id := range t.Apps {
apps = append(apps, id)
}
sort.Strings(apps)
for _, id := range apps {
for _, e := range t.Apps[id].Keys {
if !defaults[e.Key] {
return fmt.Errorf("%s: %s is no default letter, so keyd sends nothing for it", id, e.Key)
}
if e.Sends != "" {
if _, err := keydChord(e.Sends); err != nil {
return fmt.Errorf("%s: %w", id, err)
}
}
}
}
return nil
}
55 changes: 55 additions & 0 deletions cmd/image/keybinds_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
package main

import (
"os"
"strings"
"testing"
)

// keyd's file holds exactly what the table says it must: the Insert chords of copy, paste and
// cut, and the plain key of each default letter; and the table is consistent with itself.
func TestKeydFollowsTheKeysTable(t *testing.T) {
t.Chdir("../..")
table, err := readKeysTable("image/rootfs/usr/share/construct/keys.json")
if err != nil {
t.Fatal(err)
}
if err := table.check(); err != nil {
t.Fatal(err)
}
want, err := table.keydLines()
if err != nil {
t.Fatal(err)
}
conf, err := os.ReadFile("image/rootfs/etc/keyd/default.conf")
if err != nil {
t.Fatal(err)
}
if got := keydBindings(string(conf)); strings.Join(got, "\n") != strings.Join(want, "\n") {
t.Errorf("etc/keyd/default.conf's [meta] layer:\n%s\nkeys.json says:\n%s", strings.Join(got, "\n"), strings.Join(want, "\n"))
}
// xkeyboard-config's evdev map gives F13 to F24's keycodes XF86 keysyms the extension cannot
// grab and gsd acts on; only its fkeys(basic_13-24), applied by the image's own rules, makes
// them F13 to F24.
rules, err := os.ReadFile("image/rootfs/etc/xkb/rules/evdev")
if err != nil {
t.Fatal(err)
}
if !strings.Contains(string(rules), "! include %S/evdev") || !strings.Contains(string(rules), "* = +fkeys(basic_13-24)") {
t.Error("etc/xkb/rules/evdev does not apply fkeys(basic_13-24) over xkeyboard-config's rules, without which keyd's F13 to F24 are not F13 to F24")
}
if len(table.Apps) < 2 || table.Apps["com.mitchellh.ghostty.desktop"].Name == "" {
t.Errorf("the terminals are in the table: %v", table.Apps)
}
}

func TestKeydChord(t *testing.T) {
for accel, want := range map[string]string{"<Control>Insert": "C-insert", "<Shift>Delete": "S-delete", "<Control><Shift>t": "C-S-t", "F13": "f13"} {
if got, err := keydChord(accel); err != nil || got != want {
t.Errorf("%s: %q %v", accel, got, err)
}
}
if _, err := keydChord("<Super>"); err == nil {
t.Error("an accelerator without a key")
}
}
28 changes: 28 additions & 0 deletions cmd/image/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,34 @@ func (r *report) keyd(v *qemu.VM, g *guest) {
until(60*time.Second, time.Second, func() bool { got, err = g.run(`cat `+keydProbeOut, ""); return err == nil })
r.add("keyd: Super+V, A, C, X", got == "mkjkj" && overview == "false",
fmt.Sprintf("the field held %q, want \"mkjkj\"; overview open %s", got, overview)+errText(err))
// The letters keyd sends as plain keys reach the focused application as the chord it binds
// (usr/share/construct/keys.json, the keys extension): Super+T, W and R to a window posing as
// Files are Ctrl+T, Ctrl+W and Ctrl+R; to one posing as Ghostty, Ctrl+Shift+T and
// Ctrl+Shift+W, and nothing for R, which is the shell's own history search.
for _, c := range []struct{ pose, want string }{
{"org.gnome.Nautilus", "ctrl+t\nctrl+w\nctrl+r"},
{"com.mitchellh.ghostty", "ctrl+shift+t\nctrl+shift+w"},
} {
_, _ = g.run(`rm -f `+keydProbeOut, "")
if _, err := g.eval(`GLib.spawn_command_line_async("/usr/lib/construct-test/keyd-probe.py ` + c.pose + `"); true`); err != nil {
r.add("keys: "+c.pose, false, "the probe: "+err.Error())
continue
}
if !until(20*time.Second, time.Second, func() bool {
var has string
_ = g.evalJSON(`return global.get_window_actors().map(a => a.meta_window).filter(w => w.get_title() === "`+keydProbeTitle+`").map(w => (Main.activateWindow(w), w.has_focus())).some(Boolean) ? "true" : "false";`, &has)
return has == "true"
}) {
r.add("keys: "+c.pose, false, "the probe's window never had the focus")
continue
}
step("meta_l", "t")
step("meta_l", "w")
step("meta_l", "r")
var got string
until(60*time.Second, time.Second, func() bool { got, err = g.run(`cat `+keydProbeOut, ""); return err == nil })
r.add("keys: "+c.pose, strings.TrimSpace(got) == c.want, fmt.Sprintf("the window got %q, want %q", strings.TrimSpace(got), c.want)+errText(err))
}
}

// usbStick plugs a stick into the running session as a person does: udisks sees it, GNOME mounts
Expand Down
16 changes: 8 additions & 8 deletions image/apko.lock.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ contents:
- bluez-doc=5.88-r1
- bolt=0.9.11-r1
- ccid=1.8.4-r0
- code=1.145.2-r0
- code=1.148.0-r0
- colord=1.4.8-r0
- colord-gtk=0.3.1-r0
- construct-brand=0_git20261005-r5
Expand Down Expand Up @@ -380,9 +380,9 @@ contents:
- curl-doc=8.23.0-r4
- cyrus-sasl-heimdal-libs=2.1.28-r59
- db=2026.10.8-r2
- dbus=1.16.4-r0
- dbus-doc=1.16.4-r0
- dbus-libs=1.16.4-r0
- dbus=1.16.4-r1
- dbus-doc=1.16.4-r1
- dbus-libs=1.16.4-r1
- dmidecode=3.7-r5
- dmidecode-doc=3.7-r5
- docbook-xml=4.5-r10
Expand Down Expand Up @@ -917,8 +917,8 @@ contents:
- libxkbcommon=1.13.2-r5
- libxkbcommon-doc=1.13.2-r5
- libxkbfile=1.2.0-r6
- libxml2-16=2.15.4-r5
- libxml2-utils=2.15.4-r5
- libxml2-16=2.15.4-r6
- libxml2-utils=2.15.4-r6
- libxrandr=1.5.5-r8
- libxrender-dev=0.9.13-r2
- libxrender1=0.9.13-r2
Expand Down Expand Up @@ -1096,8 +1096,8 @@ contents:
- util-linux-misc=2.42.4-r3
- util-linux-su=2.42.4-r3
- util-macros=1.20.2-r6
- vim=9.2.1428-r0
- vim-doc=9.2.1428-r0
- vim=9.2.1434-r0
- vim-doc=9.2.1434-r0
- vulkan-loader=1.4.369-r0
- vulkan-loader-libs=1.4.369-r0
- wayland-libs-client=1.26.0-r4
Expand Down
4 changes: 2 additions & 2 deletions image/initrd/apko.lock.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ contents:
- cryptsetup=2.8.9-r0
- curl=8.23.0-r4
- cyrus-sasl-heimdal-libs=2.1.28-r59
- dbus=1.16.4-r0
- dbus-libs=1.16.4-r0
- dbus=1.16.4-r1
- dbus-libs=1.16.4-r1
- e2fsprogs=1.47.4-r6
- e2fsprogs-libs=1.47.4-r6
- fontconfig-config=2.18.4-r0
Expand Down
Loading