Skip to content

Commit 6d90b55

Browse files
committed
mkdir: stop using SecureJoin in test
This is needed for the future pathrs-lite subpackage split. If we want to include some backward-compatibility helpers for the pathrs-lite split, the pathrs-lite code cannot import code from the main package. Luckily it isn't really necessary to use SecureJoin in the first place. Signed-off-by: Aleksa Sarai <[email protected]>
1 parent fdd770b commit 6d90b55

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

mkdir_linux_test.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,12 @@ var mkdirAll_MkdirAllHandle mkdirAllFunc = func(t *testing.T, root, unsafePath s
5050
}
5151
defer handle.Close() //nolint:errcheck // test code
5252

53-
// We can use SecureJoin here because we aren't being attacked in this
54-
// particular test. Obviously this check is bogus for actual programs.
55-
expectedPath, err := SecureJoin(root, unsafePath)
53+
// We can lookup the expected path again to get the full path. This will
54+
// give a reasonable result because we aren't being attacked in this
55+
// particular test.
56+
handle2, err := OpenatInRoot(rootDir, unsafePath)
57+
require.NoError(t, err)
58+
expectedPath, err := procfs.ProcSelfFdReadlink(handle2)
5659
require.NoError(t, err)
5760

5861
// Now double-check that the handle is correct.

0 commit comments

Comments
 (0)