repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by bugabinga

fix dotfiles crypto and ci

709b9f5016100db3aff8de13f8a35eb3ccc39851

Oliver Krylow <o.krylow@isp-insoft.de> ·

unsigned

Browse filesCompare with HEAD

- reject already-encrypted AES input in the clean filter
- use WSL distro names as symlink manifests
- rename the heavy container task to ci

Changed files (7)

AGENTS.md

Modified
7 7 Use `mise` tasks; host bootstrap assumes Git + mise, then mise supplies Java.
8 8 Root `mise.toml` tools are dorkfiles bootstrap deps only; other apps come from system/package manager.
9 9 Root mise task shell is `scripts/mise_shell.java`, not Nushell/Bash.
10 -`mise run test` also needs host Podman; its Fedora container installs Git/mise, then mise supplies Java.
10 +`mise run ci` also needs host Podman; its Fedora container installs Git/mise, then mise supplies Java.
11 11 Never print decrypted secrets.
12 12 Do not delete noisy research/cache/untracked files unless explicitly asked.
69 69 Heavy integration:
71 71 ```sh
72 -mise run test
72 +mise run ci
75 75 HOME/system mutating; only run after explicit user request:

ArchLinux-dev.symlinks

Added
new file mode 100644
1 +pi
2 +~/.pi
4 +Notes
5 +~/Notes
7 +git/gitconfig
8 +~/.config/git/config
10 +git/gitattributes
11 +~/.config/git/gitattributes
13 +git/gitconfig.isp
14 +~/.config/git/.gitconfig.include
16 +gh
17 +~/.config/gh
19 +cargo/config.toml
20 +~/.cargo/config.toml
22 +bat/config
23 +~/.config/bat/config
25 +bash/bash_profile
26 +~/.bash_profile
28 +bash/bashrc
29 +~/.bashrc
31 +bash
32 +~/.config/bash
34 +tmux
35 +~/.config/tmux
37 +nushell
38 +~/.config/nushell
40 +topgrade/topgrade.toml
41 +~/.config/topgrade.toml
43 +topgrade/wsl.toml
44 +~/.config/topgrade.d/wsl.toml
46 +paru/paru.conf
47 +~/.config/paru/paru.conf
49 +ssh
50 +~/.ssh
52 +neovim
53 +~/.config/nvim
55 +zed
56 +~/.config/zed
58 +jj
59 +~/.config/jj
61 +glow
62 +~/.config/glow
64 +mise-config
65 +~/.config/mise
67 +claude/settings.json
68 +~/.claude/settings.json
70 +claude/statusline.js
71 +~/.claude/statusline.js
73 +claude/cc-statusline-hook.js
74 +~/.claude/cc-statusline-hook.js
76 +claude/CLAUDE.md
77 +~/.claude/CLAUDE.md
79 +claude/RTK.md
80 +~/.claude/RTK.md
82 +codex/config.toml
83 +~/.codex/config.toml

bootstripper.java

Modified
230 230 var encrypted = run(root, List.of("java", "tools/aes.java", "encrypt", "--key-file", key_file), plain, false).stdout;
231 231 if (!starts_with(encrypted, aes_magic))
232 232 throw fail("AES self-test did not produce expected magic header.");
233 + var repeated = run(root, List.of("java", "tools/aes.java", "encrypt", "--key-file", key_file), encrypted, false, false);
234 + if (repeated.exit == 0 || !repeated.error().contains("input is already a dotfiles AES blob"))
235 + throw fail("AES self-test did not reject already-encrypted input.");
233 236 var decrypted = run(root, List.of("java", "tools/aes.java", "decrypt", "--key-file", key_file), encrypted, false).stdout;
234 237 if (!Arrays.equals(plain, decrypted))
235 238 throw fail("AES self-test failed to round-trip.");
395 398 var explicit = System.getenv("DOTFILES_SYMLINKS");
396 399 if (explicit != null && !explicit.isBlank())
397 400 return explicit.replaceFirst("\\.symlinks$", "");
398 - if (is_wsl() && Files.exists(root.resolve("wsl.symlinks")))
399 - return "wsl";
400 401 return hostname;
403 - static boolean is_wsl() {
404 - var distro = System.getenv("WSL_DISTRO_NAME");
405 - if (distro != null && !distro.isBlank())
406 - return true;
407 - try {
408 - var release = Files.readString(Path.of("/proc/sys/kernel/osrelease"), StandardCharsets.UTF_8).toLowerCase();
409 - return release.contains("microsoft") || release.contains("wsl");
410 - } catch (IOException ignored) {
411 - return false;
412 - }
413 - }
415 404 static void create_symlinks(Path root, Path symlinks_file) throws Throwable {
416 405 log("Creating symlinks as defined in {0} file.", emphasize_local(symlinks_file.getFileName().toString()));
417 406 var lines = Files.readAllLines(symlinks_file);
562 551 static String hostname() throws Exception {
563 - if (is_wsl())
564 - return "wsl";
565 552 var computername = System.getenv("COMPUTERNAME");
566 553 if (computername != null && !computername.isBlank())
567 554 return computername;
555 + var wsl_distro = System.getenv("WSL_DISTRO_NAME");
556 + if (wsl_distro != null && !wsl_distro.isBlank())
557 + return wsl_distro;
568 558 var hostname = System.getenv("HOSTNAME");
569 559 if (hostname != null && !hostname.isBlank() && !"localhost".equals(hostname))
570 560 return hostname;

mise.toml

Modified
14 14 description = "Verify crypto, hooks, secrets, and symlink manifests"
15 15 run = 'run("java", "bootstripper.java", "check");'
17 -[tasks.test]
18 -description = "Run Podman integration test"
17 +[tasks.ci]
18 +description = "Run committed-state Podman CI check"
19 19 run = 'run("java", "./scripts/dotfiles_integration_test.java");'
21 -[tasks.test-inside]
22 -description = "Run Podman container checks"
21 +[tasks.ci-check]
22 +description = "Run the CI check suite"
23 23 hide = true
24 24 run = 'run("java", "./scripts/dotfiles_integration_test.java", "--inside");'

scripts/dotfiles_integration_test.java

Modified
39 39 ok("mise-trusted");
40 40 step("install mise tools");
41 41 runInherit(null, "podman", "exec", "-w", "/root/work/dotfiles", container, "mise", "install");
42 - step("run mise test-inside");
43 - runInherit(null, "podman", "exec", "-w", "/root/work/dotfiles", container, "mise", "run", "test-inside");
42 + step("run ci check");
43 + runInherit(null, "podman", "exec", "-w", "/root/work/dotfiles", container, "mise", "exec", "--", "java", "./scripts/dotfiles_integration_test.java", "--inside");
44 44 } finally {
45 45 runAllowFail(null, "podman", "rm", "-f", container);
164 164 run(repo, env, "git", "add", ".dotfiles-aes-salt", ".secrets", "bootstripper.java", "tools/aes.java", "mini.symlinks", "dummy.txt", "secret.txt");
165 165 run(repo, env, "java", "bootstripper.java", "check");
166 166 if (!run(repo, "git", "show", ":secret.txt").startsWith("DFAES1")) fail("fresh-staged-encrypted");
167 + run(repo, env, "java", "tools/aes.java", "encrypt", "--key-file", ".git/dotfiles-aes.key", "secret.txt", "encrypted-secret.txt");
168 + Files.write(repo.resolve("secret.txt"), Files.readAllBytes(repo.resolve("encrypted-secret.txt")));
169 + Files.delete(repo.resolve("encrypted-secret.txt"));
170 + if (!runExpectFail(repo, env, "git", "add", "secret.txt").contains("input is already a dotfiles AES blob")) fail("encrypted-worktree-clean-not-rejected");
171 + Files.writeString(repo.resolve("secret.txt"), "not a real secret\n");
172 + var wslHome = home.resolve("fresh-wsl-home");
173 + Files.createDirectories(wslHome);
174 + var wslEnv = new HashMap<>(env);
175 + wslEnv.put("JAVA_TOOL_OPTIONS", "-Duser.home=" + wslHome);
176 + wslEnv.put("COMPUTERNAME", "");
177 + wslEnv.put("WSL_DISTRO_NAME", "mini");
178 + wslEnv.put("HOSTNAME", "ignored");
179 + run(repo, wslEnv, "java", "bootstripper.java", "bootstrap");
180 + if (!Files.isSymbolicLink(wslHome.resolve("dummy.txt"))) fail("fresh-wsl-distro-manifest");
181 + run(repo, wslEnv, "java", "bootstripper.java", "clean");
167 182 var env2 = new HashMap<>(env); env2.put("HOSTNAME", "mini");
168 183 Files.createSymbolicLink(home.resolve("dummy.txt"), Path.of("/usr/lib/outside-home"));
169 184 if (!runExpectFail(repo, env2, "java", "bootstripper.java", "bootstrap").contains("outside HOME")) fail("outside-home-symlink-not-rejected");

tools/aes.java

Modified
83 83 static byte[] encrypt(byte[] key, byte[] plaintext) throws Exception {
84 84 if (startsWith(plaintext, MAGIC)) {
85 - return plaintext;
85 + throw new IllegalArgumentException("input is already a dotfiles AES blob");
88 88 var split = splitKey(key);

wsl.symlinks

Deleted
deleted file mode 100644
1 -pi
2 -~/.pi
4 -Notes
5 -~/Notes
7 -git/gitconfig
8 -~/.config/git/config
10 -git/gitattributes
11 -~/.config/git/gitattributes
13 -git/gitconfig.isp
14 -~/.config/git/.gitconfig.include
16 -gh
17 -~/.config/gh
19 -cargo/config.toml
20 -~/.cargo/config.toml
22 -bat/config
23 -~/.config/bat/config
25 -bash/bash_profile
26 -~/.bash_profile
28 -bash/bashrc
29 -~/.bashrc
31 -bash
32 -~/.config/bash
34 -tmux
35 -~/.config/tmux
37 -nushell
38 -~/.config/nushell
40 -topgrade/topgrade.toml
41 -~/.config/topgrade.toml
43 -topgrade/wsl.toml
44 -~/.config/topgrade.d/wsl.toml
46 -paru/paru.conf
47 -~/.config/paru/paru.conf
49 -ssh
50 -~/.ssh
52 -neovim
53 -~/.config/nvim
55 -zed
56 -~/.config/zed
58 -jj
59 -~/.config/jj
61 -glow
62 -~/.config/glow
64 -mise-config
65 -~/.config/mise
67 -claude/settings.json
68 -~/.claude/settings.json
70 -claude/statusline.js
71 -~/.claude/statusline.js
73 -claude/cc-statusline-hook.js
74 -~/.claude/cc-statusline-hook.js
76 -claude/CLAUDE.md
77 -~/.claude/CLAUDE.md
79 -claude/RTK.md
80 -~/.claude/RTK.md
82 -codex/config.toml
83 -~/.codex/config.toml