一键导入
path-boundary-comparison
How to perform root-path containment checks without weakening security on case-sensitive filesystems
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
How to perform root-path containment checks without weakening security on case-sensitive filesystems
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Investigate .NET CI failures using the hlx CLI tool via bash. USE FOR: checking Helix job status, searching build logs, downloading test results, AzDO build timeline analysis — when MCP tools aren't loaded, when the MCP server isn't configured or fails to start, or when scripting with JSON output and jq. DO NOT USE FOR: tasks where Helix/AzDO MCP tools are already available in context (prefer ci-analysis skill when MCP server is loaded). INVOKES: bash (hlx CLI commands with --json output).
{what this skill teaches agents}
Audit pattern for comparing WorkItemSummary (list API) fields against WorkItemDetails (per-item API) after a Helix.Client SDK bump
Domain-layer normalizer + JSON-stable cache key pattern for filter types with server-side defaults and case-insensitive fields.
Strict unknown-parameter rejection for MCP tools: Stage A (UnmappedMemberHandling.Disallow) + Stage B (did-you-mean CallToolFilter).
Audit MCP/CLI tool parameter surface against underlying REST API capabilities to find silently-dropped params.
| name | path-boundary-comparison |
| description | How to perform root-path containment checks without weakening security on case-sensitive filesystems |
| domain | security |
| confidence | medium |
| source | earned |
Use this when code must verify that a computed file path stays inside a trusted root directory. This commonly appears in cache stores, download helpers, extraction code, and any path traversal defense.
Path.GetFullPath(...) before comparing.Path.DirectorySeparatorChar for child-path checks.StringComparison.Ordinal, not ignore-case comparisons. Case folding can make a sibling path appear to be under the trusted root on case-sensitive filesystems.root vs ROOT) so the security fix stays pinned if someone later reintroduces ignore-case comparisons.var fullPath = Path.GetFullPath(path);
var fullRoot = Path.GetFullPath(root);
var rootWithoutSeparator = Path.TrimEndingDirectorySeparator(fullRoot);
var rootedPrefix = rootWithoutSeparator + Path.DirectorySeparatorChar;
if (!fullPath.StartsWith(rootedPrefix, StringComparison.Ordinal) &&
!string.Equals(fullPath, rootWithoutSeparator, StringComparison.Ordinal))
{
throw new ArgumentException("Resolved path escapes the trusted root.");
}
StartsWith(..., StringComparison.OrdinalIgnoreCase) for a security boundary check./tmp/root2 look like it is inside /tmp/root.Path.GetFullPath(...).