Skip to content
github.com/cyphar/filepath-securejoin v0.6.0 -- "By the Power of Greyskull!"

While quite small code-wise, this release marks a very key point in the
development of filepath-securejoin.

filepath-securejoin was originally intended (back in 2017) to simply be
a single-purpose library that would take some common code used in
container runtimes (specifically, Docker's FollowSymlinksInScope) and
make it more general-purpose (with the eventual goals of it ending up in
the Go stdlib).

Of course, I quickly discovered that this problem was actually far more
complicated to solve when dealing with racing attackers, which lead to
me developing openat2(2) and libpathrs. I had originally planned for
libpathrs to completely replace filepath-securejoin "once it was ready"
but in the interim we needed to fix several race attacks in runc as part
of security advisories. Obviously we couldn't require the usage of a
pre-0.1 Rust library in runc so it was necessary to port bits of
libpathrs into filepath-securejoin. (Ironically the first prototypes of
libpathrs were originally written in Go and then rewritten to Rust, so
the code in filepath-securejoin is actually Go code that was rewritten
to Rust then re-rewritten to Go.)

It then became clear that pure-Go libraries will likely not be willing
to require CGo for all of their builds, so it was necessary to accept
that filepath-securejoin will need to stay. As such, in v0.5.0 we
provided more pure-Go implementations of features from libpathrs but
moved them into "pathrs-lite" subpackage to clarify what purpose these
helpers serve.

This release finally closes the loop and makes it so that pathrs-lite
can transparently use libpathrs (via a "libpathrs" build-tag). This
means that upstream libraries can use the pure Go version if they
prefer, but downstreams (either downstream library users or even
downstream distributions) are able to migrate to libpathrs for all
usages of pathrs-lite in an entire Go binary.

I should make it clear that I do not plan to port the rest of libpathrs
to Go, as I do not wish to maintain two copies of the same codebase.
pathrs-lite already provides the core essentials necessary to operate on
paths safely for most modern systems. Users who want additional
hardening or more ergonomic APIs are free to use "cyphar.com/go-pathrs"
(libpathrs's Go bindings).

Breaking:

- The deprecated MkdirAll, MkdirAllHandle, OpenInRoot, OpenatInRoot and
  Reopen wrappers have been removed. Please switch to using pathrs-lite
  directly.

Added:

- pathrs-lite now has support for using libpathrs as a backend. This is
  opt-in and can be enabled at build time with the "libpathrs" build
  tag. The intention is to allow for downstream libraries and other
  projects to make use of the pure-Go "filepath-securejoin/pathrs-lite"
  package and distributors can then opt-in to using libpathrs for the
  entire binary if they wish.

Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>