detached 114ac55

fix(bootstrap): harden development sandbox root

commit
114ac55b695c41d6d43b2e1cc5d34c2c4dbaac80
author
brice · · 2026-08-15 13:09 UTC
parent
7e592a5
signature
GPG VerifiedCD88F9E564E0102646FB6077A1A07C7C7C3E349D · arch-gpg Verified for the committer email
2 files · +17 -1
M internal/bootstrap/development_environment.go +1 -1
@@ -25,7 +25,7 @@ func ApplyDevelopmentEnvironment() error {
2525 }
2626
2727 devDir := filepath.Join(cwd, ".dev")
28- if err := ensureDevelopmentDirectory(devDir, false); err != nil {
28+ if err := ensureDevelopmentDirectory(devDir, true); err != nil {
2929 return err
3030 }
3131
@@ -25,7 +25,7 @@ func ApplyDevelopmentEnvironment() error {
25 }25 }
26 26
27 devDir := filepath.Join(cwd, ".dev")27 devDir := filepath.Join(cwd, ".dev")
28- if err := ensureDevelopmentDirectory(devDir, false); err != nil {28+ if err := ensureDevelopmentDirectory(devDir, true); err != nil {
29 return err29 return err
30 }30 }
31 31
M internal/bootstrap/development_environment_test.go +16 -0
@@ -39,6 +39,22 @@ func TestApplyDevelopmentEnvironment_DevIsolatesHomeAndXDGDirectories(t *testing
3939 require.Equal(t, "/run/user/1000", os.Getenv("XDG_RUNTIME_DIR"))
4040 }
4141
42+func TestApplyDevelopmentEnvironment_DevTightensExistingDevDirectoryPermissions(t *testing.T) {
43+ worktree := t.TempDir()
44+ t.Chdir(worktree)
45+ t.Setenv("ENV", developmentEnvironmentName)
46+
47+ devDir := filepath.Join(worktree, ".dev")
48+ require.NoError(t, os.Mkdir(devDir, 0o777))
49+ require.NoError(t, os.Chmod(devDir, 0o777))
50+
51+ require.NoError(t, ApplyDevelopmentEnvironment())
52+
53+ info, err := os.Stat(devDir)
54+ require.NoError(t, err)
55+ require.Equal(t, os.FileMode(0o700), info.Mode().Perm())
56+}
57+
4258 func TestApplyDevelopmentEnvironment_DevRejectsSandboxSymlink(t *testing.T) {
4359 worktree := t.TempDir()
4460 t.Chdir(worktree)
@@ -39,6 +39,22 @@ func TestApplyDevelopmentEnvironment_DevIsolatesHomeAndXDGDirectories(t *testing
39 require.Equal(t, "/run/user/1000", os.Getenv("XDG_RUNTIME_DIR"))39 require.Equal(t, "/run/user/1000", os.Getenv("XDG_RUNTIME_DIR"))
40 }40 }
41 41
42+func TestApplyDevelopmentEnvironment_DevTightensExistingDevDirectoryPermissions(t *testing.T) {
43+ worktree := t.TempDir()
44+ t.Chdir(worktree)
45+ t.Setenv("ENV", developmentEnvironmentName)
46+
47+ devDir := filepath.Join(worktree, ".dev")
48+ require.NoError(t, os.Mkdir(devDir, 0o777))
49+ require.NoError(t, os.Chmod(devDir, 0o777))
50+
51+ require.NoError(t, ApplyDevelopmentEnvironment())
52+
53+ info, err := os.Stat(devDir)
54+ require.NoError(t, err)
55+ require.Equal(t, os.FileMode(0o700), info.Mode().Perm())
56+}
57+
42 func TestApplyDevelopmentEnvironment_DevRejectsSandboxSymlink(t *testing.T) {58 func TestApplyDevelopmentEnvironment_DevRejectsSandboxSymlink(t *testing.T) {
43 worktree := t.TempDir()59 worktree := t.TempDir()
44 t.Chdir(worktree)60 t.Chdir(worktree)

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 8

Tags 42

↑↓ moveenter openesc close