forked from admin/VolcanicAgenticCore
HostProcessHardening calls prctl(PR_SET_DUMPABLE, 0) through LibraryImport, once per process, from the ProcessSpawnPolicy constructor, and warns when DOTNET_EnableDiagnostics is not 0. Test projects consume the one-shot call with the flag off in a module initializer. A HardeningProbe helper backs a Linux-only /proc integration test.
12 lines
549 B
C#
12 lines
549 B
C#
// Test helper: `dotnet Volcanic.AgenticCore.HardeningProbe.dll harden|plain`. Prints "ok" once hardening ran, then
|
|
// waits until stdin closes so the test can read /proc/<pid>/environ in between.
|
|
using Microsoft.Extensions.Logging.Abstractions;
|
|
using Volcanic.AgenticCore.Features.Processes;
|
|
|
|
var harden = args.Length > 0 && args[0] == "harden";
|
|
HostProcessHardening.Apply(new ProcessEnvironmentOptions { HardenHostProcess = harden }, NullLogger.Instance);
|
|
Console.WriteLine("ok");
|
|
Console.Out.Flush();
|
|
await Console.In.ReadToEndAsync();
|
|
return 0;
|