Skip to content

fix: secure generated file healing workflow - #3204

Open
Tal Zaccai (TalZaccai) wants to merge 6 commits into
mainfrom
dev/talzacc/secure-healing-workflow
Open

Tal Zaccai (TalZaccai) wants to merge 6 commits into
mainfrom
dev/talzacc/secure-healing-workflow

Conversation

@TalZaccai

Copy link
Copy Markdown
Contributor
  • Split healing into a read-only, no-secret producer and a privileged default-branch workflow_run finalizer.
  • Execute only the immutable, verified default-branch healer and treat exact PR contents strictly as data in a credential-free repository.
  • Reject PR-controlled package-manager/resolver code and regenerate lockfiles from sanitized inputs with trusted pnpm configuration.
  • Independently verify the artifact, object graph, exact parents, tree, allowed diff, and live PR/base/head/ref/repository metadata before finalization.
  • Mint the repository-scoped App token only after validation and expose it only to one clean bare-repository push process with an exact-head lease.
  • Preserve legitimate generated README and lockfile healing, including App-authored pushes that retrigger normal PR checks.
  • Add 20 focused offline security regressions and validate the full tools-script suite, standalone-pnpm healing, workflow parsing, formatting, frozen install, builds, repository policy, and ratchets.

Platform limitations: the finalizer becomes active only after landing on the default branch; GitHub has no atomic metadata-check/ref-update API, so the finalizer immediately revalidates metadata and uses an exact SHA lease to reject head races; hosted synchronize delivery cannot be proven offline.

Split candidate preparation from the privileged finalizer, reconstruct and verify exact merge objects, isolate trusted pnpm inputs, and gate the App token to a leased push.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Unresolved security vulnerabilities and healing failures undermine the intended isolation and reliability.

4 open issues
What changed in this PR

Hardens generated-file conflict healing by separating candidate preparation from privileged verification and pushing.

Changes:

  • Splits healing into read-only producer and privileged finalizer workflows.
  • Adds isolated lockfile regeneration, artifact validation, and exact-head push leases.
  • Adds focused security and healing regression tests.
File Description
ts/​tools/​scripts/​test/​generatedFileHealing.spec.mjs Adds isolation, metadata, healing, and push tests.
ts/​tools/​scripts/​lib/​generatedFileHealing.mjs Implements preparation, verification, and guarded pushing.
ts/​tools/​scripts/​heal-generated-files.mjs Exposes prepare, verify, and push commands.
.github/​workflows/​heal-generated-files.yml Creates candidates without write credentials.
.github/​workflows/​heal-generated-files-finalize.yml Verifies candidates before minting an App token.

Review effort: Balanced

Comment thread ts/tools/scripts/lib/generatedFileHealing.mjs
Comment thread ts/tools/scripts/lib/generatedFileHealing.mjs Outdated
Comment thread ts/tools/scripts/lib/generatedFileHealing.mjs
Comment thread ts/tools/scripts/lib/generatedFileHealing.mjs
Keep read-only GitHub metadata collection separate from credential-free preparation, fetch trusted code without checkout credentials, and skip the legacy healer only for the initial secure-workflow rollout.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Comment thread ts/tools/scripts/test/generatedFileHealing.spec.mjs Fixed
Reject unsafe manifest paths and symlinks, require exact deterministic commit messages, configure merge identity early, and isolate per-PR policy failures during scans.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Resolve the standalone pnpm entrypoint from PNPM_HOME or the global shim layout so the real lockfile-healing test runs under pnpm/action-setup on Windows.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants