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.
14 lines
528 B
C#
14 lines
528 B
C#
using System.Runtime.CompilerServices;
|
|
using Microsoft.Extensions.Logging.Abstractions;
|
|
using Volcanic.AgenticCore.Features.Processes;
|
|
|
|
namespace Volcanic.AgenticCore.Extensions.Tests;
|
|
|
|
/// <summary>Consumes the process-wide hardening call with the flag off, so the test runner stays debuggable.</summary>
|
|
internal static class NoHostHardening
|
|
{
|
|
[ModuleInitializer]
|
|
internal static void Disable() =>
|
|
HostProcessHardening.Apply(new ProcessEnvironmentOptions { HardenHostProcess = false }, NullLogger.Instance);
|
|
}
|