Skip to content

guardrails: block-windows-drive-tmp misses four write shapes on main #5179

Closed

Description

@kyle-sexton

Problem

A bypass review of #4811 (Python read-only open) found four shapes that write to a drive-root temp path and pass plugins/guardrails/hooks/block-windows-drive-tmp.sh on current main (rc=0). They are unrelated to #4811; main allows them today.

Tested the way block-windows-drive-tmp.test.sh feeds the hook (jq {tool_name,tool_input:{command}} on stdin, OSTYPE=msys):

  1. Space before the call paren: python3 -c "open ('/tmp/x','w').write('a')".
  2. Indirect builtin: python3 -c "getattr(__builtins__,'open')('/tmp/x','w')".
  3. Homoglyph name: оpen(...) with a Cyrillic о, which Python rejects, so this one only matters if the hook's matcher is reused for detection elsewhere.
  4. C:\Temp / C:/Temp spellings are not covered at all; the guard matches tmp forms only.

Expected

Items 1-2 block like open(. Item 4: decide whether Temp (the Windows default %TEMP% parent on some setups) is in scope; if yes, match it case-insensitively; if not, say so in the README. Item 3 needs no change unless the matcher gains another consumer.

Acceptance criteria

  • Test cases for 1, 2 and the chosen Temp behavior in block-windows-drive-tmp.test.sh.
  • README states the covered path spellings.

Related

Activity

  1. added
    needs-triage
    on Sep 28, 2026
  2. kyle-sexton commented on Sep 28, 2026

    @kyle-sexton
    MemberAuthor

    Two more shapes that main allows, found in the #4811 re-review: a write whose path is built by concatenation never matches the tmp-path literal, e.g. python3 -c "import shutil; shutil.copy('/etc/hosts', '/'+'tmp/y')" and python3 -c "import os; os.system('touch /'+chr(116)+'mp/y')". Main also doesn't inspect shutil.copy, os.rename, os.system or python3 /tmp/x targets when no open( sits next to the tmp literal. Worth deciding whether those write APIs should count as signals.

  3. kyle-sexton commented on Sep 29, 2026

    @kyle-sexton
    MemberAuthor

    This was generated by AI during triage.

    Agent Brief

    Type: Bug
    Summary: block-windows-drive-tmp catches a space before the open paren and a getattr-resolved builtin open; README states the guard covers tmp only.

    Current behavior:
    Verified on main: open ('/tmp/x','w') and getattr(__builtins__,'open')('/tmp/x','w') are not blocked. C:\Temp is not covered because the guard matches tmp only.

    Desired behavior:
    The two write shapes above are blocked. The README states the guard covers drive-root tmp only, and that it is a deterrent over one command string, not a sandbox.

    Acceptance criteria:

    • Test cases for both shapes, each expecting a block.
    • README names the tmp-only scope and the deterrent-not-sandbox non-goal.

    Out of scope:

    • Temp / C:\Temp coverage (see decision below).
    • Concatenated paths, shutil, os.system and other shapes from the comment thread (unbounded; non-goal).
  4. kyle-sexton commented on Sep 29, 2026

    @kyle-sexton
    MemberAuthor

    This was generated by AI during triage.

    Decision defaulted: Temp is out of scope; document the guard as tmp-only and fix only the space-before-paren and getattr shapes — veto before merge
    Basis: judgment; probes on main (both shapes rc=0); guard README describes a deterrent over one command string

  5. added
    agent-ready
    status: ready
    and removed
    needs-triage
    on Sep 29, 2026
  6. added theissue type on Sep 29, 2026
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

    agent-readystatus: ready

    Type

    Fields

    No fields configured for Bug.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions