Deterministic/reproducible packaging for `Compress-PSResource`

Open
#2,047 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
45/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
csharp, powershell
Domain
cli, tooling

Research direction

Begin at the Compress-PSResource entry point and trace package generation, including timestamps, PSMDCP naming, .rels, and [Content_Types].xml ordering. Done means default output is reproducible and -Timestamp applies to all packaged files, with deterministic names and XML ordering.

Written by the indexing model from the issue text.

Description

feature_request Needs-Triage
Summary of the new feature / enhancement

Deterministic/reproducible builds are an undeniably important feature for auditability and security. Currently, Compress-PSResource doesn't provide support for that, and it should.

Currently, I post-process my packages to ensure fully reproducible output, which takes significant time in a build.

Proposed technical implementation details (optional)

There are a few sources of non-determinism I have observed in Compress-PSResource:

  • The timestamps of files in the zipped package.
  • The PSMDCP file name is non-deterministic. Consequently, the .rels file content is non-deterministic.
  • The [Content_Types].xml content, notably the order of children, is non-deterministic. (? I remember observing this but couldn't give a stable reproduction at the moment.)

Suggestion.

  1. Make Compress-PSResource deterministic by default. PSMDCP name can be a hash of non-.rels non-.psmdcp files, and [Content_Types].xml children should be sorted.
  2. Provide a new parameter -Timestamp. When this parameter is set, all files in the package should use this timestamp.
Dominant language
C#
Stars
576
Forks
114
Avg merge
1d 2h
Merged PRs (30d)
7

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from PowerShell/PSResourceGet

All issues in PowerShell/PSResourceGet

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.