-
Notifications
You must be signed in to change notification settings - Fork 19
Comparing changes
Open a pull request
base repository: cyphar/filepath-securejoin
base: v0.3.0
head repository: cyphar/filepath-securejoin
compare: v0.3.1
Commits on Jul 11, 2024
-
Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
Configuration menu - View commit details
-
Copy full SHA for 8ebc3bc - Browse repository at this point
Copy the full SHA 8ebc3bcView commit details
Commits on Jul 12, 2024
-
Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
Configuration menu - View commit details
-
Copy full SHA for c95d0cc - Browse repository at this point
Copy the full SHA c95d0ccView commit details -
build(deps): bump actions/setup-go from 4 to 5
Bumps [actions/setup-go](https://github.com/actions/setup-go) from 4 to 5. - [Release notes](https://github.com/actions/setup-go/releases) - [Commits](actions/setup-go@v4...v5) --- updated-dependencies: - dependency-name: actions/setup-go dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com>
Configuration menu - View commit details
-
Copy full SHA for fb29038 - Browse repository at this point
Copy the full SHA fb29038View commit details -
Configuration menu - View commit details
-
Copy full SHA for 01910fc - Browse repository at this point
Copy the full SHA 01910fcView commit details
Commits on Jul 15, 2024
-
lookup: use readlinkat(fd, "") to get link components
readlinkat(2) implies AT_EMPTY_PATH, so we can just use it to look up an opened symlink component in a race-free way. This removes one possible race (which we handled already, but it's nice to completely avoid it). This feature was added in 2011 in commit 65cfc6722361 ("readlinkat(), fchownat() and fstatat() with empty relative pathnames"), which is more than old enough for us to depend on. If someone uses filepath-securejoin on a v2.6.38 kernel, that's their own problem. Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
Configuration menu - View commit details
-
Copy full SHA for 927d002 - Browse repository at this point
Copy the full SHA 927d002View commit details
Commits on Jul 16, 2024
-
tests: fix race when pausing rename swap
The pauseCh was only synchronised one way, which resulted in a race window here the test thread (after requesting the pause) would get the real path before the rename thread swapped the file back. This is easily fixed by doing the swap twice each loop iteration so that we only receive pause requests when we are in an okay-to-be-paused state. Removing the retry logic lets us do far more test runs for the racing tests, removing the need for the -short suite. The MkdirAll tests are still a bit slow, but 2k runs should be fine. Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
Configuration menu - View commit details
-
Copy full SHA for a604eb6 - Browse repository at this point
Copy the full SHA a604eb6View commit details
Commits on Jul 23, 2024
-
test mocks: procfs: make unsafe fallback more realistic
It makes more sense to make the open("/proc") unsafe fallback more like a hasNewMountApi() failure. Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
Configuration menu - View commit details
-
Copy full SHA for 46f5a26 - Browse repository at this point
Copy the full SHA 46f5a26View commit details -
tests: lookup: actually swap root in root-swap tests
renameat2(fd, ".", ...) is not allowed, and so our rename-swap tests where we swap the root itself would silently do nothing (this explains why the racing tests would always succeed). The tests still pass, so our logic was correct, we just didn't exercise that particular check properly. Fixes: ac32743 ("tests: add racing tests for partialLokupInRoot and MkdirAllHandle") Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
Configuration menu - View commit details
-
Copy full SHA for 964931f - Browse repository at this point
Copy the full SHA 964931fView commit details -
mkdir: fix *os.File leak when reopening starting path
When switching away from O_PATH, we forgot to close the O_PATH handle when replacing it with the non-O_DIRECTORY handle. Fixes: ebb9f1f ("mkdirall: switch away from O_PATH for mkdir loop") Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
Configuration menu - View commit details
-
Copy full SHA for 82c423e - Browse repository at this point
Copy the full SHA 82c423eView commit details -
open: make OpenInRoot errors match a simple openat2
Because we use partialOpenInRoot as the backend implementation of OpenInRoot (which didn't return error information when a partial lookup succeeded), we would map all non-complete errors as ENOENT. This meant that for non-directories you didn't get ENOTDIR, which is what you'd get from a basic openat2(RESOLVE_IN_ROOT) using the path. While we could map the error in OpenInRoot to -ENOTDIR in simple cases, in dangling symlink cases OpenInRoot doesn't know what source error stopped the iteration. So we have to change the partialOpenInRoot API to return an error when a partial open is done, and all of the callers need to be updated to handle that. Since partialOpenInRoot is an internal API, this slightly unconventional interface (where a non-nil error is paired with actual value information) is not that bad. This also lets us remove a bit of duplication from partialOpenInRoot when handling a non-directory component, which I think makes things much nicer. Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
Configuration menu - View commit details
-
Copy full SHA for b6bd996 - Browse repository at this point
Copy the full SHA b6bd996View commit details -
lookup: special-case non-partial lookups
For openat2 this means we can just one-shot the lookup (making our lookups faster) and for partialLookupInRoot we can not bother with the symlink stack (and simplify the error handling case when doing a complete lookup). Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
Configuration menu - View commit details
-
Copy full SHA for 1f4688a - Browse repository at this point
Copy the full SHA 1f4688aView commit details -
merge #17 into cyphar/filepath-securejoin:main
Aleksa Sarai (5): test mocks: procfs: make unsafe fallback more realistic tests: lookup: actually swap root in root-swap tests mkdir: fix *os.File leak when reopening starting path open: make OpenInRoot errors match a simple openat2 lookup: special-case non-partial lookups LGTMs: cyphar
Configuration menu - View commit details
-
Copy full SHA for edab538 - Browse repository at this point
Copy the full SHA edab538View commit details -
procfs: use readlink(fd, "") for magic-links
By operating on the magic-link directly, we (in theory) should be safe against a racing mount even when using unsafeHostProcRoot(). There's not much we can do about Reopen, but at least the core lookup logic should be safe against race attacks. Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
Configuration menu - View commit details
-
Copy full SHA for 45c4415 - Browse repository at this point
Copy the full SHA 45c4415View commit details -
procfs: refactor statx mnt_id logic
This should lower the chance of checking the wrong paths if we ever rework this code (though our tests do catch bugs here). Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
Configuration menu - View commit details
-
Copy full SHA for 38b1220 - Browse repository at this point
Copy the full SHA 38b1220View commit details -
merge #19 into cyphar/filepath-securejoin:main
Aleksa Sarai (2): procfs: use readlink(fd, "") for magic-links procfs: refactor statx mnt_id logic LGTMs: cyphar
Configuration menu - View commit details
-
Copy full SHA for ecd61ca - Browse repository at this point
Copy the full SHA ecd61caView commit details -
lookup: handle // and trailing slash components correctly
When we hit empty components, we need to treat them as though they are a "." component. We could skip them for non-trailing components but for trailing components it's critical to actually try to do the open so that we get openat2-like errors for non-directory states. For the single trailing slash case, it's simpler to implement it as a final "." open after we've done the other lookups (we could switch to using an array of path component like libpathrs does, but this is a simpler change). Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
Configuration menu - View commit details
-
Copy full SHA for f29b7a4 - Browse repository at this point
Copy the full SHA f29b7a4View commit details -
merge #21 into cyphar/filepath-securejoin:main
Aleksa Sarai (1): lookup: handle // and trailing slash components correctly LGTMs: cyphar
Configuration menu - View commit details
-
Copy full SHA for 2404ffb - Browse repository at this point
Copy the full SHA 2404ffbView commit details -
CHANGELOG: add initial changelog with current history
Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
Configuration menu - View commit details
-
Copy full SHA for 16e1bec - Browse repository at this point
Copy the full SHA 16e1becView commit details -
merge #22 into cyphar/filepath-securejoin:main
Aleksa Sarai (1): CHANGELOG: add initial changelog with current history LGTMs: cyphar
Configuration menu - View commit details
-
Copy full SHA for 4ea279f - Browse repository at this point
Copy the full SHA 4ea279fView commit details -
CHANGELOG: add readlinkat(fd, "") shout-out
Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
Configuration menu - View commit details
-
Copy full SHA for a2c14f8 - Browse repository at this point
Copy the full SHA a2c14f8View commit details -
Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
Configuration menu - View commit details
-
Copy full SHA for ce7b28a - Browse repository at this point
Copy the full SHA ce7b28aView commit details
There are no files selected for viewing
Large diffs are not rendered by default.