Class ModuleUploadService
Handles remote module deployment: validates and installs an uploaded .tpkg, and rolls a
module back to its previous on-disk version. Every defense lives here, so the controller stays
thin:
upload disabled unless Tsak:Modules:Upload:Enabled=true;size ceiling;the bytes must be a valid ZIP containing manifest.json with a name;the stored filename is derived from the manifest name and sanitized — never from client
input — so a crafted name cannot escape the target directory (zip-slip / path traversal);signature verified before anything touches the live directory (fail-fast), in
addition to the authoritative load-boundary check in HotReloadService;atomic install (temp file → move), with the previous version archived for rollback.
public sealed class ModuleUploadService
Inheritance
Properties
UploadEnabled
public bool UploadEnabled { get; }
Methods
InstallAsync(byte[], byte[]?, CancellationToken)
Validates and installs an uploaded package. signatureBytes is the detached
public Task<ModuleDeployResult> InstallAsync(byte[] packageBytes, byte[]? signatureBytes, CancellationToken ct)
Rollback(string)
Restores the most recent archived version of a module.
public ModuleDeployResult Rollback(string moduleName)
Validate(byte[], byte[]?)
Dry-run validation of an uploaded package — same structural + signature checks as
public ModuleDeployResult Validate(byte[] packageBytes, byte[]? signatureBytes)