Skip to content

fix(deps): update module github.com/cyphar/filepath-securejoin to v0.4.1 - autoclosed#25001

Closed
renovate[bot] wants to merge 1 commit intomainfrom
renovate/github.com-cyphar-filepath-securejoin-0.x
Closed

fix(deps): update module github.com/cyphar/filepath-securejoin to v0.4.1 - autoclosed#25001
renovate[bot] wants to merge 1 commit intomainfrom
renovate/github.com-cyphar-filepath-securejoin-0.x

Conversation

@renovate
Copy link
Contributor

@renovate renovate bot commented Jan 13, 2025

This PR contains the following updates:

Package Change Age Adoption Passing Confidence
github.com/cyphar/filepath-securejoin v0.3.6 -> v0.4.1 age adoption passing confidence

Warning

Some dependencies could not be looked up. Check the Dependency Dashboard for more information.


Release Notes

cyphar/filepath-securejoin (github.com/cyphar/filepath-securejoin)

v0.4.1

Compare Source

This release fixes a regression introduced in one of the hardening
features added to filepath-securejoin 0.4.0.

  • The restrictions added for root paths passed to SecureJoin in 0.4.0 was
    found to be too strict and caused some regressions when folks tried to
    update, so this restriction has been relaxed to only return an error if the
    path contains a .. component. We still recommend users use filepath.Clean
    (and even filepath.EvalSymlinks) on the root path they are using, but at
    least you will no longer be punished for "trivial" unclean paths. (#​46)

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

v0.4.0

Compare Source

This release primarily includes a few minor breaking changes to make the
MkdirAll and SecureJoin interfaces more robust against accidental
misuse.

  • SecureJoin(VFS) will now return an error if the provided root is not a
    filepath.Clean'd path.

    While it is ultimately the responsibility of the caller to ensure the root is
    a safe path to use, passing a path like /symlink/.. as a root would result
    in the SecureJoin'd path being placed in / even though /symlink/..
    might be a different directory, and so we should more strongly discourage
    such usage.

    All major users of securejoin.SecureJoin already ensure that the paths they
    provide are safe (and this is ultimately a question of user error), but
    removing this foot-gun is probably a good idea. Of course, this is
    necessarily a breaking API change (though we expect no real users to be
    affected by it).

    Thanks to Erik Sjölund, who initially
    reported this issue as a possible security issue.

  • MkdirAll and MkdirHandle now take an os.FileMode-style mode argument
    instead of a raw unix.S_*-style mode argument, which may cause compile-time
    type errors depending on how you use filepath-securejoin. For most users,
    there will be no change in behaviour aside from the type change (as the
    bottom 0o777 bits are the same in both formats, and most users are probably
    only using those bits).

    However, if you were using unix.S_ISVTX to set the sticky bit with
    MkdirAll(Handle) you will need to switch to os.ModeSticky otherwise you
    will get a runtime error with this update. In addition, the error message you
    will get from passing unix.S_ISUID and unix.S_ISGID will be different as
    they are treated as invalid bits now (note that previously passing said bits
    was also an error).

Thanks to the following contributors for helping make this release
possible:

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


Configuration

📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Never, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

@renovate renovate bot added dependencies Pull requests that update a dependency file release-note-none labels Jan 13, 2025
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jan 13, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: renovate[bot]
Once this PR has been reviewed and has the lgtm label, please assign rhatdan for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@packit-as-a-service
Copy link

Ephemeral COPR build failed. @containers/packit-build please check.

@renovate renovate bot force-pushed the renovate/github.com-cyphar-filepath-securejoin-0.x branch from 14d50b7 to a254be2 Compare January 13, 2025 08:57
@mtrmac
Copy link
Contributor

mtrmac commented Jan 14, 2025

This needs opencontainers/runc#4590 .

@mtrmac
Copy link
Contributor

mtrmac commented Jan 21, 2025

Just so that it is not lost, Podman tests also need updating:

commit 4449a5ad759dc3a917b5fed75334cc3342ed68f2
Author: Miloslav Trmač <mitr@redhat.com>
Date:   Tue Jan 14 22:54:19 2025 +0100

    WIP: Update for filepath-securejoin 0.4.0
    
    The root of filepath.* now must exist.
    
    Signed-off-by: Miloslav Trmač <mitr@redhat.com>

diff --git a/libpod/container_internal_linux_test.go b/libpod/container_internal_linux_test.go
index 4deb513b8..586c5fc19 100644
--- a/libpod/container_internal_linux_test.go
+++ b/libpod/container_internal_linux_test.go
@@ -18,7 +18,7 @@ func TestGenerateUserPasswdEntry(t *testing.T) {
                        },
                },
                state: &ContainerState{
-                       Mountpoint: "/does/not/exist/tmp/",
+                       Mountpoint: t.TempDir(),
                },
        }
        user, err := c.generateUserPasswdEntry(0)
@@ -44,7 +44,7 @@ func TestGenerateUserGroupEntry(t *testing.T) {
                        },
                },
                state: &ContainerState{
-                       Mountpoint: "/does/not/exist/tmp/",
+                       Mountpoint: t.TempDir(),
                },
        }
        group, err := c.generateUserGroupEntry(0)

@kolyshkin
Copy link
Contributor

Most probably a newer version (0.4.1?) will be released, relaxing the SecureJoin's root requirement (see cyphar/filepath-securejoin#47). Therefore, we can just skip 0.4.0.

@cyphar
Copy link

cyphar commented Jan 28, 2025

@kolyshkin
Copy link
Contributor

Can someone please tick the 'rebase' checkbox in the description (to bump to 0.4.1)?

@renovate renovate bot force-pushed the renovate/github.com-cyphar-filepath-securejoin-0.x branch from a254be2 to 0213d06 Compare January 31, 2025 20:16
@renovate renovate bot changed the title fix(deps): update module github.com/cyphar/filepath-securejoin to v0.4.0 fix(deps): update module github.com/cyphar/filepath-securejoin to v0.4.1 Jan 31, 2025
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
@renovate renovate bot force-pushed the renovate/github.com-cyphar-filepath-securejoin-0.x branch from 0213d06 to 553da36 Compare February 4, 2025 16:38
@mtrmac
Copy link
Contributor

mtrmac commented Feb 4, 2025

opencontainers/runc#4590 was merged, but only on the main branch; Go calls that version v1.2.1-0.20250204225634-71cef22161ea < v1.2.4 which we have now, so using that directly would trigger various downgrades. We would need to use the replace directive; without a strong reason to update immediately, I’d prefer not to.

Options:

  • runc upstream merges the 1.2.4 tag into main, and Podman follows the main branch until runc 1.3 is released.
  • Podman uses replace to use runc from the main branch, until runc 1.3 is released.
  • runc releases v1.2.5 with the incompatible filepath-securejoin update, Podman updates to that.
  • Podman keeps runc at 1.24, and filepath-securejoin at the current version, until runc 1.3. We hope that there are no vulnerabilities or other reasons to immediately update filepath-securejoin
  • Eventually Go 1.24 has a native os.Root; I didn’t investigate that in detail. It will take a long time (a year?) until Podman can require Go 1.24.

@cyphar
Copy link

cyphar commented Feb 5, 2025

runc releases v1.2.5 with the incompatible filepath-securejoin update, Podman updates to that.

This is the most likely thing to happen. We have a few fixes that might merit a backport, I'll try to submit something soon.

Eventually Go 1.24 has a native os.Root; I didn’t investigate that in detail. It will take a long time (a year?) until Podman can require Go 1.24.

os.Root doesn't match what container runtimes need -- os.Root has RESOLVE_BENEATH behaviour rather than RESOLVE_IN_ROOT behaviour (at least that was the design when I last commented in the design proposal thread and the author seemed to be stuck on making the design RESOLVE_BENEATH-like). Real container images have absolute links and wacky symlinks, and we need to resolve them a-la RESOLVE_IN_ROOT to avoid breakages.

@renovate renovate bot changed the title fix(deps): update module github.com/cyphar/filepath-securejoin to v0.4.1 fix(deps): update module github.com/cyphar/filepath-securejoin to v0.4.1 - autoclosed Feb 14, 2025
@renovate renovate bot closed this Feb 14, 2025
@renovate renovate bot deleted the renovate/github.com-cyphar-filepath-securejoin-0.x branch February 14, 2025 15:56
@stale-locking-app stale-locking-app bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label May 16, 2025
@stale-locking-app stale-locking-app bot locked as resolved and limited conversation to collaborators May 16, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

dependencies Pull requests that update a dependency file locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. release-note-none

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants