Skip to content

OCI layer extraction fails with "unsupported file mode" on some bundle images #332

Open

Description

@mclasmeier

Problem

extractTarToDir in internal/ocihelper/ocihelper.go:181 passes os.FileMode(header.Mode) directly to root.OpenFile. Tar headers can include Unix file-type bits (e.g. 0100644 for a regular file), not just the 9 permission bits. Go's Root.OpenFile rejects any mode with bits above 0o777 with unsupported file mode.

This fails for bundle images whose builder writes full Unix mode values into tar layers (e.g. stackrox-operator-bundle:vlatest), while images that only store permission bits (e.g. v4.11.6) work fine.

Fix

Mask the mode on line 181:

os.FileMode(header.Mode) & os.ModePerm

Reproduction

https://github.com/stackrox/central-login/actions/runs/41603850345/job/125808734282?pr=621

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions