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)
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.
75 75 HOME/system mutating; only run after explicit user request:
ArchLinux-dev.symlinks
Addednew file mode 100644 11 +~/.config/git/gitattributes
14 +~/.config/git/.gitconfig.include
40 +topgrade/topgrade.toml
41 +~/.config/topgrade.toml
44 +~/.config/topgrade.d/wsl.toml
47 +~/.config/paru/paru.conf
68 +~/.claude/settings.json
71 +~/.claude/statusline.js
73 +claude/cc-statusline-hook.js
74 +~/.claude/cc-statusline-hook.js
bootstripper.java
Modified230 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")))
403 - static boolean is_wsl() {
404 - var distro
= System.getenv(
"WSL_DISTRO_NAME");
405 - if (distro
!= null && !distro.isBlank())
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) {
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 {
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())
568 558 var hostname
= System.getenv(
"HOSTNAME");
569 559 if (hostname
!= null && !hostname.isBlank()
&& !"localhost".equals(hostname))
14 14 description =
"Verify crypto, hooks, secrets, and symlink manifests" 15 15 run =
'run("java", "bootstripper.java", "check");' 18 -description =
"Run Podman integration test" 18 +description =
"Run committed-state Podman CI check" 19 19 run =
'run("java", "./scripts/dotfiles_integration_test.java");' 22 -description =
"Run Podman container checks" 22 +description =
"Run the CI check suite" 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");
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");
83 83 static byte[] encrypt(
byte[] key,
byte[] plaintext) throws
Exception {
84 84 if (startsWith(plaintext,
MAGIC)) {
85 + throw new IllegalArgumentException(
"input is already a dotfiles AES blob");
88 88 var split
= splitKey(key);
deleted file mode 10064411 -~/.config/git/gitattributes
14 -~/.config/git/.gitconfig.include
40 -topgrade/topgrade.toml
41 -~/.config/topgrade.toml
44 -~/.config/topgrade.d/wsl.toml
47 -~/.config/paru/paru.conf
68 -~/.claude/settings.json
71 -~/.claude/statusline.js
73 -claude/cc-statusline-hook.js
74 -~/.claude/cc-statusline-hook.js