Skip to content

fix(git): normalize tar headers of git archives - #2124

Draft
matthiasbruns wants to merge 1 commit into
open-component-model:mainfrom
matthiasbruns:fix/git-reproducible-archive
Draft

matthiasbruns wants to merge 1 commit into
open-component-model:mainfrom
matthiasbruns:fix/git-reproducible-archive

Conversation

@matthiasbruns

@matthiasbruns matthiasbruns commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

On-behalf-of: SAP matthias.bruns@sap.com

What this PR does / why we need it

The git access and git input archive a temporary checkout with tarutils.TgzFs, which takes owner, group and permissions from Lstat. Their digest therefore depends on the user, umask and temporary directory that built it: the same commit gives different digests for the v1 CLI and the v1 library on the same machine, and OCM v2 cannot verify any of them.

This adds an opt-in NormalizeHeaders option to tarutils.TarFileSystemOptions (uid/gid 0, no user/group names, no access/change time, permissions from the file type and executable bit) and enables it for blobaccess/git. Other PackFsIntoTar callers are unchanged. For the same commit the archive is now byte-identical to OCM v2's bindings/go/git output.

Digests of existing git access resources change once; they have to be re-added or re-digested.

Which issue(s) this PR is related to

Related to open-component-model/ocm-project#1341

Signed-off-by: Matthias Bruns <git@matthiasbruns.com>
On-behalf-of: SAP <matthias.bruns@sap.com>
matthiasbruns added a commit to open-component-model/open-component-model that referenced this pull request Sep 25, 2026
On-behalf-of: SAP <matthias.bruns@sap.com>

<!-- markdownlint-disable MD041 -->
#### What this PR does / why we need it

Adds git access resource repo and typing.
During this PR we found out that ocmv1 packs tars differently:

Things we could fix here;
- bring over the tar layout to match the tar contents from v1 (opt in)
Things we will fix in ocmv1
- digest calculation based on tars with uname and other host infos in
the file headers - this cannot work during verify on v1 and v2 - see
open-component-model/ocm#2124

#### Which issue(s) this PR fixes
Contributes:
open-component-model/ocm-project#1257

---------

Signed-off-by: Matthias Bruns <git@matthiasbruns.com>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant