Skip to content

Add safe ClickOnce publish-layout staging - #1058

Open
dtivel wants to merge 2 commits into
dtivel/clickonce-file-graphfrom
dtivel/clickonce-safe-staging
Open

Add safe ClickOnce publish-layout staging#1058
dtivel wants to merge 2 commits into
dtivel/clickonce-file-graphfrom
dtivel/clickonce-safe-staging

Conversation

@dtivel

@dtivel dtivel commented Aug 16, 2026

Copy link
Copy Markdown
Collaborator

Part of #1049.

Summary

  • Add dormant staging for ResolvedClickOncePublishLayout while preserving its typed deployment, application, payload, and adjacent-executable associations.
  • Build an immutable staging plan and validate every destination before performing filesystem or manifest-reference changes.
  • Reject rooted, traversing, escaping, colliding, and otherwise unrepresentable staging paths while preserving manifest-relative target paths.
  • Copy the resolved publish layout into an isolated temporary directory and bind manifest references only to staged files.
  • Temporarily remove only explicitly mapping-added .deploy suffixes while manifest file information is updated, then restore both filenames and references.
  • Restore manifest references and clean up staged files during normal disposal and failure rollback.

Design

Staging is mode-neutral. Signing and manifest-update policy remain responsibilities of the later application and deployment orchestration changes.

Planning and execution are separated: ClickOnceStagingPlanBuilder performs pure allocation and validation, while ClickOncePublishLayoutStager performs copying and reference binding. ClickOnceStagingSession owns the temporary staging lifecycle and mapped-suffix update scope.

Behavior

No production signing behavior or CLI surface is changed. The staging implementation remains dormant until it is integrated by later ClickOnce signing changes.

Testing

  • Release restore, build, and all unit-test projects: 947 total, 946 passed, 1 skipped, 0 failed.
  • Build completed with 0 warnings and 0 errors.
  • Diff hygiene and stale staging-terminology checks passed.

@dtivel
dtivel requested a review from a team as a code owner August 16, 2026 03:21
@dtivel
dtivel requested a review from kartheekp-ms August 16, 2026 03:21
@dtivel
dtivel requested a balanced review from Copilot August 16, 2026 03:31

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds dormant, contained ClickOnce file-graph staging for the future version 2 signing pipeline.

Changes:

  • Adds deterministic staging, collision preflight, reference rebinding, and rollback.
  • Supports default, no-dependency-signing, and no-update modes.
  • Adds localized errors and extensive staging tests.
Show a summary per file
File Description
src/Sign.Core/Tools/ClickOnce/ClickOnceFileGraphStager.cs Implements staging and collision validation.
src/Sign.Core/Tools/ClickOnce/ClickOnceStagingResult.cs Manages staged state and rollback.
src/Sign.Core/Tools/ClickOnce/ClickOnceStagedFile.cs Models a staged file.
src/Sign.Core/Tools/ClickOnce/ClickOnceSigningMode.cs Defines staging modes.
src/Sign.Core/Tools/ClickOnce/ClickOnceFileGraphStagingException.cs Adds staging-specific errors.
src/Sign.Core/Resources.resx Adds staging error resources.
src/Sign.Core/Resources.Designer.cs Exposes generated resource properties.
src/Sign.Core/xlf/Resources.cs.xlf Adds Czech localization entries.
src/Sign.Core/xlf/Resources.de.xlf Adds German localization entries.
src/Sign.Core/xlf/Resources.es.xlf Adds Spanish localization entries.
src/Sign.Core/xlf/Resources.fr.xlf Adds French localization entries.
src/Sign.Core/xlf/Resources.it.xlf Adds Italian localization entries.
src/Sign.Core/xlf/Resources.ja.xlf Adds Japanese localization entries.
src/Sign.Core/xlf/Resources.ko.xlf Adds Korean localization entries.
src/Sign.Core/xlf/Resources.pl.xlf Adds Polish localization entries.
src/Sign.Core/xlf/Resources.pt-BR.xlf Adds Brazilian Portuguese entries.
src/Sign.Core/xlf/Resources.ru.xlf Adds Russian localization entries.
src/Sign.Core/xlf/Resources.tr.xlf Adds Turkish localization entries.
src/Sign.Core/xlf/Resources.zh-Hans.xlf Adds Simplified Chinese entries.
src/Sign.Core/xlf/Resources.zh-Hant.xlf Adds Traditional Chinese entries.
test/Sign.Core.Test/Tools/ClickOnce/ClickOnceFileGraphStagerTests.cs Covers staging, collisions, and recovery.

Review details

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Files not reviewed (1)
  • src/Sign.Core/Resources.Designer.cs: Generated file
  • Files reviewed: 20/21 changed files
  • Comments generated: 0
  • Review effort level: Balanced

@dtivel
dtivel force-pushed the dtivel/clickonce-safe-staging branch from bddf243 to b947483 Compare September 6, 2026 13:57
@dtivel dtivel changed the title Add safe ClickOnce file graph staging Add safe ClickOnce publish-layout staging Sep 6, 2026
Stage resolved ClickOnce publish layouts in an isolated temporary directory without changing production signing behavior. Validate all destinations before copying, preserve typed layout associations, safely manage mapping-added suffixes during file-info updates, and restore references and files during cleanup.

Separate pure staging-plan construction from filesystem execution and cover path safety, collisions, rollback, lifecycle behavior, and source-tree immutability.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@dtivel
dtivel force-pushed the dtivel/clickonce-safe-staging branch from b947483 to 37abaea Compare September 6, 2026 13:59
@dtivel
dtivel requested a balanced review from Copilot September 6, 2026 13:59

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

Multi-extension Windows device names can bypass planning validation and reach filesystem operations.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review tier: Balanced
Findings: 1 High severity

New issues introduced by this change (1)
Severity Finding
High severity src/​Sign.Core/​Tools/​ClickOnce/​ClickOnceStagingPlanBuilder.cs — Reserved DOS device names with multiple extensions bypass this check:…
Files not reviewed (1)
  • src/Sign.Core/Resources.Designer.cs: Generated file

Comment thread src/Sign.Core/Tools/ClickOnce/ClickOnceStagingPlanBuilder.cs Outdated
Validate the portion before the first extension separator so reserved device names cannot bypass staging preflight. Cover a multi-extension reserved directory segment without filesystem side effects.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
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.

2 participants