From b0e3e7dc7485c3f67a3c5babdd53eae848991333 Mon Sep 17 00:00:00 2001 From: OfficeCom Codex Date: Sat, 25 Jul 2026 10:15:23 +0200 Subject: [PATCH] Preserve upload configuration during scan and upload --- .../Commands/ScanAndUploadCommand.cs | 32 +++++++++++++++++-- src/OCSentinelCli/OCSentinelCli.csproj | 2 +- 2 files changed, 31 insertions(+), 3 deletions(-) diff --git a/src/OCSentinelCli/Commands/ScanAndUploadCommand.cs b/src/OCSentinelCli/Commands/ScanAndUploadCommand.cs index ac0d5b0..61d0734 100644 --- a/src/OCSentinelCli/Commands/ScanAndUploadCommand.cs +++ b/src/OCSentinelCli/Commands/ScanAndUploadCommand.cs @@ -5,7 +5,10 @@ internal static class ScanAndUploadCommand public static int Execute(string[] args) { string outputPath = @"C:\ProgramData\OCSentinel\reports\latest.json"; + string? clientConfigPath = null; + string? secretPath = null; bool hasOutput = false; + var scanArgs = new List(); for (int i = 0; i < args.Length; i++) { @@ -13,11 +16,26 @@ internal static class ScanAndUploadCommand { outputPath = args[i + 1]; hasOutput = true; - break; + scanArgs.Add(args[i]); + scanArgs.Add(args[++i]); + continue; } + + if (string.Equals(args[i], "--client-config", StringComparison.OrdinalIgnoreCase) && i + 1 < args.Length) + { + clientConfigPath = args[++i]; + continue; + } + + if (string.Equals(args[i], "--secret-path", StringComparison.OrdinalIgnoreCase) && i + 1 < args.Length) + { + secretPath = args[++i]; + continue; + } + + scanArgs.Add(args[i]); } - List scanArgs = [.. args]; if (!hasOutput) { scanArgs.Add("--output"); @@ -36,6 +54,16 @@ internal static class ScanAndUploadCommand outputPath }; + if (!string.IsNullOrWhiteSpace(clientConfigPath)) + { + uploadArgs.AddRange(["--client-config", clientConfigPath]); + } + + if (!string.IsNullOrWhiteSpace(secretPath)) + { + uploadArgs.AddRange(["--secret-path", secretPath]); + } + return UploadCommand.Execute([.. uploadArgs]); } } diff --git a/src/OCSentinelCli/OCSentinelCli.csproj b/src/OCSentinelCli/OCSentinelCli.csproj index 3464c58..0e23d35 100644 --- a/src/OCSentinelCli/OCSentinelCli.csproj +++ b/src/OCSentinelCli/OCSentinelCli.csproj @@ -9,7 +9,7 @@ OCSentinelCli OfficeCom Sentinel OfficeCom - 1.2.5 + 1.2.6 1.2.3.0 1.2.3.0 1.2.3