Skip to content

[Bug]: Windows pre-tool permission hooks intermittently reject valid paths due to slash and drive-letter casing mismatches #37402

Closed as not planned

Description

@HITECHDEM

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/server

Steps to reproduce

  1. On Windows, define an agent pre-tool hook or permission policy restricting file access to a specific directory tree.
  2. During multi-step execution, an agent calls tools with paths formatted with forward slashes (e.g. C:/Tools/.../manifest.json or c:/...) while filesystem comparisons or workspace roots use backslashes (C:\Tools\...\manifest.json).
  3. Observe tool execution.

Expected behavior

Path comparison in permission checks should normalize paths case-insensitively and slash-agnostically on Windows (path.resolve / path.normalize / lowercase drive letters), allowing access to whitelisted project paths.

Actual behavior

The pre-tool hook denies access to valid files inside allowed directories with:

Encountered error in step execution: denied by pre-tool hook: Access to path "C:/Tools/..."

This occurs because strict string comparisons (targetPath.startsWith(allowedRoot)) fail when:

  • Drive letters differ in casing (C: vs c:).
  • Slashes differ (/ vs \).
  • Relative segments (./, ../) are present.

Impact

Minor bug or occasional failure

Version or commit

T3 Code 0.1.9 / core 0.169.0

Environment

Windows 11 x64, Desktop app

Workaround & Suggested Fix

In permission checks and hook evaluators, normalize both target and candidate paths using Windows path canonicalization before evaluating prefixes:

function isPathAllowed(targetPath: string, allowedRoot: string): boolean {
  const normTarget = path.normalize(path.resolve(targetPath)).toLowerCase();
  const normRoot = path.normalize(path.resolve(allowedRoot)).toLowerCase();
  return normTarget.startsWith(normRoot);
}

Activity

  1. juliusmarminge commented on Nov 15, 2026

    @juliusmarminge
    Member

    @HITECHDEM Which provider were you running (Claude Code, Codex, Antigravity, Kiro, ...), and is the pre-tool hook that prints 'denied by pre-tool hook' a script you wrote or that provider's built-in check? Please paste its configuration. T3 Code has no pre-tool hook or path policy of its own, so the comparison that fails must be in that hook.

  2. HITECHDEM commented on Nov 15, 2026

    @HITECHDEM
    Author

    Thanks for investigating. I rechecked the original failure: the provider was Antigravity ACP, and the denial came from its pre-tool check. I cannot substantiate my claim that T3 Code mishandles Windows path normalization; the attempted access was outside the permitted workspace. The original report and suggested fix were incorrect. Sorry for the misleading report; I am closing this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs more infoInitial triage showed no bug. Awaiting more info

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions