(t *testing.T)
| 624 | } |
| 625 | |
| 626 | func TestBootstrapRefusesSymlinkedConfigYAML(t *testing.T) { |
| 627 | root := t.TempDir() |
| 628 | dir := filepath.Join(root, DirName) |
| 629 | if err := os.MkdirAll(dir, 0o700); err != nil { |
| 630 | t.Fatal(err) |
| 631 | } |
| 632 | // Plant config.yaml as a symlink pointing outside the project. |
| 633 | target := filepath.Join(t.TempDir(), "external.yaml") |
| 634 | cfgPath := filepath.Join(dir, "config.yaml") |
| 635 | if err := os.Symlink(target, cfgPath); err != nil { |
| 636 | t.Skipf("symlink unsupported: %v", err) |
| 637 | } |
| 638 | _, _, err := Bootstrap(root) |
| 639 | if err == nil { |
| 640 | t.Fatal("Bootstrap accepted a symlinked config.yaml") |
| 641 | } |
| 642 | // Attacker target must not be clobbered with the seed. |
| 643 | if _, err := os.Stat(target); err == nil { |
| 644 | t.Fatal("Bootstrap wrote through the config.yaml symlink - seed bytes landed at attacker target") |
| 645 | } |
| 646 | } |
| 647 | |
| 648 | func TestBootstrapRefusesNonDirectoryAtCodehamrPath(t *testing.T) { |
| 649 | root := t.TempDir() |
nothing calls this directly
no test coverage detected