Some checks failed
Docs CI / lint-and-preview (push) Has been cancelled
- Implemented PolicyDslValidator with command-line options for strict mode and JSON output. - Created PolicySchemaExporter to generate JSON schemas for policy-related models. - Developed PolicySimulationSmoke tool to validate policy simulations against expected outcomes. - Added project files and necessary dependencies for each tool. - Ensured proper error handling and usage instructions across tools.
16 lines
432 B
C#
16 lines
432 B
C#
namespace StellaOps.Bench.PolicyEngine;
|
|
|
|
internal static class PathUtilities
|
|
{
|
|
public static bool IsWithinRoot(string root, string candidate)
|
|
{
|
|
var relative = Path.GetRelativePath(root, candidate);
|
|
if (string.IsNullOrEmpty(relative) || relative == ".")
|
|
{
|
|
return true;
|
|
}
|
|
|
|
return !relative.StartsWith("..", StringComparison.Ordinal) && !Path.IsPathRooted(relative);
|
|
}
|
|
}
|