Skip to content

Add default-off SignalR scheduling with fresh push eligibility checks - #554

Draft
JusterZhu wants to merge 2 commits into
justerzhu-push-client-record-integrationfrom
justerzhu-push-scheduling-integration
Draft

JusterZhu wants to merge 2 commits into
justerzhu-push-client-record-integrationfrom
justerzhu-push-scheduling-integration

Conversation

@JusterZhu

@JusterZhu JusterZhu commented Nov 23, 2026 •

Copy link
Copy Markdown
Collaborator

Safety status — DRAFT / NOT DEPLOYABLE for credential-bearing flow

The existing EncryptedFileProcessContractProvider uses a public constant-derived AES key, fixed IV and deterministic file path. There is no demonstrated OS ACL enforcement, parent/child identity authentication, authenticated endpoint–tenant binding, tamper rejection or replay rejection. Selecting an installation directory and deleting a read file are not those guarantees. A local attacker can alter contract fields, including the validation switch. Tenant-header fixtures and different PIDs are not an authenticated handshake or production security evidence.

Keep this PR draft. Published safety gate 528c5a51f896b86c97a8aa958cd5aefa9073e8f1 rejects automatic configurations containing any CustomHeaders (including tenant headers), API Token or Basic credentials before listening. The mapper also refuses those exports, and the validated updater rejects credential-bearing contracts. The new header IPC propagation has been removed. Required local AppSecretKey is not exported in automatic IPC or used for automatic HTTP API authentication. Local downloads requiring tenant headers or authentication cannot use this automatic layer. The previous 903a3838 head is superseded and must not be used for credential-bearing integration. Secure transport requires a separate PR, not a self-declared security marker here. Old manual APIs are not secured by this gate.

Safety refusal/export paths: GeneralUpdateBootstrap.StartPushUpdatesAsync, ConfigurationMapper.MapToProcessContract, PushHttpTransport and UpdateStrategy.ExecuteAsync. Tests: ProcessContractTests.ValidatedPushContract_* and PushProcessIntegrationTests.CredentialBearingConfiguration_FailsClosedBeforeListening. The unchanged fixed-AES implementation is in Ipc/IProcessInfoProvider.cs; it creates the directory but does not enforce ACLs or authenticate peers/messages.

Scope

Independent default-off host integration on #547, base justerzhu-push-client-record-integration at c11b91210da25d010540312e6a519c676587a7ba. Relates to #319 and TSLH-Technology/GeneralSpace#328; the earlier manually wired harness did not exercise automatic scheduling or Client IPC.

  • Explicit GeneralUpdateBootstrap.EnablePushUpdates(HubConfig) starts SignalR through the existing Client bootstrap instead of Verification polling. Defaults remain unchanged; bounded messages are serialized and Client handoff stops scheduling.
  • Check product/platform/version/origin/format; require explicit Full ZIP, positive RecordId and SHA256. Automatic mode rejects unsuitable/legacy packets; manual APIs retain compatibility.
  • POST explicitly configured /Upgrade/ValidatePush before download and immediately before extraction in the existing OS pipeline, after hooks and hash checks. Require HTTP 2xx plus camelCase code=200/body=true; missing data, HTTP/business errors, malformed responses and timeouts fail closed. Pass local Hub appKey, endpoint, recordId and original ZIP hash; do not borrow Verification IDs. Final rejection avoids file writes, rollback and terminal receipts.
  • Automatic HTTP API transport carries no credentials/custom headers and disables redirects/cookies; additional exact download origins require explicit configuration. Explicit Hub AccessToken, if configured locally, is only used for that Hub connection, not exported to the updater.
  • Real loopback Kestrel/SignalR tests launch a different updater PID through public bootstrap and the existing IPC provider. Windows/Linux CI publishes and runs Native AOT hosts with the same process tests.

Verified evidence at published client 528c5a5

These results validate the limited credential-free fixture and refusal behavior, not production IPC permissions/authentication or a successful real GeneralSpace/MySQL deployment. Local native publishing is still unavailable without the Windows C++ linker; the native evidence is actual CI execution, not a local claim.

Pinned server: TSLH-Technology/GeneralSpace#338 at 51617d4342c94b44753498c295a2cac2b2d1fd6b. Do not add the withdrawn TTL. All non-success responses must be rejected.

Final real cross-repository restricted test: The integration tester reports that fixed client 528c5a51f896b86c97a8aa958cd5aefa9073e8f1 and server 51617d4342c94b44753498c295a2cac2b2d1fd6b were exercised in https://github.com/TSLH-Technology/GeneralSpace/actions/runs/45122963958 (completed/success). Actual SignalR automatic reception and first ValidatePush using recordId/appKey/hash returned HTTP 200 / code 200 / body true. Download without a tenant header returned HTTP 400 TenantContextRequired, with MySQL status 3 (download failed); updater did not start, and there was no second validation or applied marker. Independent manual download using the correct tenant header returned 200 with matching hash; a wrong header returned 400. Neither manual header was injected into IPC. The tester also reports the real MySQL eligibility matrix and inactive-tenant store preconditions were exercised. This successful restricted test is not a full end-to-end pass or proof of secure IPC.

The server owner confirmed an inactive header can remain unresolved on an anonymous request and reach the predicate (200/true); a resolved inactive tenant may instead be blocked by the activation filter, with cache effects, so 403 is not guaranteed. The predicate itself ignores the header; a tenant header is not authentication.

Remaining limits

Credential-bearing/tenant-header Local download integration remains blocked pending a separate secure channel. The eligibility tuple is not identity authentication or irrevocable authorization; freezing can race after the last check and server Report may overwrite state. One automatic listener per process is supported; do not run concurrent manual updates. Host identity, executable paths and lifecycle must be explicitly configured. Queue overflow is logged rather than durably replayed; reconnect exhaustion is not infinite recovery. Even credential-free fixture success does not prove safe production execution against local IPC attackers.

Route validated SignalR packets through the default Client and Upgrade pipelines, preserving scoped tenant context and installation IPC. Exercise real listener and updater processes, and publish/run Native AOT in CI.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 23, 2026 05:00
@JusterZhu
JusterZhu marked this pull request as draft November 23, 2026 05:03

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 authentication, certificate-policy, and header-handling defects can block push updates, while incorrect updater-launch tracking, archive cleanup, and test-host resolution introduce additional reliability and verification gaps.

6 open issues
What changed in this PR

Adds default-off SignalR scheduling to the existing Client bootstrap, extending push packet reporting with automatic update processing and fresh server eligibility checks.

Changes:

  • Adds bounded, serialized push processing with package eligibility checks and updater handoff.
  • Revalidates before download and extraction, carrying local credentials, tenant headers, and validation data through IPC.
  • Adds real SignalR/process tests, Windows/Linux Native AOT CI coverage, and integration documentation. Native CI results remain pending.
File Description
tests/​PushAotSmoke/​Program.cs Adds Client and updater process-host modes.
tests/​CoreTest/​Hubs/​PushProcessIntegrationTests.cs Tests automatic scheduling, validation, IPC, and receipts.
tests/​CoreTest/​CoreTest.csproj References the process host and ASP.NET Core framework.
src/​GeneralUpdate.Core/​Strategy/​UpdateStrategy.cs Checks push IPC contracts and handles validation rejection.
src/​GeneralUpdate.Core/​Strategy/​ClientStrategy.cs Enforces push download constraints and handles apply outcomes.
src/​GeneralUpdate.Core/​Strategy/​AbstractStrategy.cs Handles final rejection without rollback or terminal receipts.
src/​GeneralUpdate.Core/​Pipeline/​CompressMiddleware.cs Revalidates push eligibility before extraction.
src/​GeneralUpdate.Core/​Network/​PushValidationRejectedException.cs Defines the final-validation rejection exception.
src/​GeneralUpdate.Core/​Network/​PushValidationClient.cs Implements fail-closed eligibility requests.
src/​GeneralUpdate.Core/​Network/​PushHttpTransport.cs Applies locally configured authentication and headers.
src/​GeneralUpdate.Core/​Network/​HttpClientProvider.cs Adds client creation without redirects or cookies.
src/​GeneralUpdate.Core/​JsonContext/​PushPayloadJsonContext.cs Adds generated validation JSON serialization.
src/​GeneralUpdate.Core/​Hubs/​UpgradeHubService.cs Supports explicit hub headers while preserving the constructor.
src/​GeneralUpdate.Core/​Hubs/​PushUpdateListener.cs Adds bounded queuing and serialized message handling.
src/​GeneralUpdate.Core/​Download/​Reporting/​IUpdateReporter.cs Supports scoped report authentication and disposes responses.
src/​GeneralUpdate.Core/​Download/​Executors/​HttpDownloadExecutor.cs Supports scoped download authentication.
src/​GeneralUpdate.Core/​Configuration/​UpdateContext.cs Carries push validation configuration and rejection state.
src/​GeneralUpdate.Core/​Configuration/​PushValidationRequest.cs Defines validation request and response models.
src/​GeneralUpdate.Core/​Configuration/​ProcessContract.cs Carries push validation data and headers through IPC.
src/​GeneralUpdate.Core/​Configuration/​HubConfig.cs Adds automatic push configuration options.
src/​GeneralUpdate.Core/​Configuration/​ConfigurationMapper.cs Maps validation settings and header snapshots into IPC.
src/​GeneralUpdate.Core/​Bootstrap/​GeneralUpdateBootstrap.cs Integrates opt-in push scheduling and installation-scoped IPC.
docs/​core-execution-flow.md Documents setup, validation behavior, and operational limits.
.github/​workflows/​push-aot.yml Configures Windows/Linux native process-test execution.

Review effort: Balanced

Comment on lines +165 to +166
ApplyRuntimeOptions();
await StartPushUpdatesAsync().ConfigureAwait(false);
{
((ClientStrategy)configured).DownloadSource = source;
}).ConfigureAwait(false);
return strategy.HasPreparedClientUpdate;
Comment on lines +24 to +29
if (config.CustomHeaders == null) return;
foreach (var header in config.CustomHeaders)
{
request.Headers.Remove(header.Key);
request.Headers.Add(header.Key, header.Value);
}

try
{
PushHttpTransport.ApplyHeaders(config, request);
Comment on lines +288 to +289
if (!_configinfo.PushValidationRejected)
DeleteVersionZip(version);
Directory.CreateDirectory(Path.Combine(root, "updater"));
var host = Environment.GetEnvironmentVariable("GENERALUPDATE_PUSH_HOST_PATH") ??
Path.GetFullPath(Path.Combine(AppContext.BaseDirectory,
"..", "..", "..", "..", "PushAotSmoke", "bin", "Release", "net10.0",
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