Skip to content

fix(F2): hide dotfiles by default in find_files/glob/list_dir - #77

Merged
yogthos merged 1 commit into
mainfrom
fix/f2-hide-dotfiles
May 21, 2026
Merged

fix(F2): hide dotfiles by default in find_files/glob/list_dir#77
yogthos merged 1 commit into
mainfrom
fix/f2-hide-dotfiles

Conversation

@yogthos

@yogthos yogthos commented May 21, 2026

Copy link
Copy Markdown
Collaborator

Track F-CRITICAL #2. All three filesystem-walking tools defaulted to including dotfiles, leaking .env / .git/ / .DS_Store into LLM context. Added include_hidden: bool arg (defaults to false); LLM opts in when needed. 2 new tests, 651 pass.

Track F-CRITICAL #2 from ROADMAP.md.

## Problem

All three filesystem-walking tools set `.hidden(false)` on the
`ignore::WalkBuilder`. Default behavior surfaced dotfiles to the
LLM:

- `.env` files — secrets in plaintext
- `.git/` internals — refs, hooks, blobs
- `.DS_Store` — macOS metadata noise
- `.netrc`, `.aws/credentials`, etc.

Agents reading the filesystem could silently pull these into chat
context. Security + privacy leak.

## Fix

New `include_hidden: bool` arg on `FindFilesArgs`, `GlobArgs`,
`ListDirArgs` with `#[serde(default)]` (defaults to false). Walker
calls become `.hidden(!args.include_hidden)`:

- `WalkBuilder::hidden(true)` means SKIP hidden entries.
- Default (`include_hidden=false`) → `.hidden(true)` → dotfiles
  skipped, matching pi + opencode defaults.
- LLM opts in via `include_hidden: true` when it explicitly needs
  to inspect a dotfile (e.g. checking `.gitignore` contents).

Schemas updated so the LLM sees the new arg with a description
explaining the safety rationale.

Cache keys include `:hidden=<bool>` so the same pattern with
different hidden flags doesn't collide.

## Tests

Two new tests in `agent::tools::glob::tests`:

- `glob_skips_dotfiles_by_default`: writes `.env`, `.gitignore`,
  `main.rs` to a temp tree; asserts default glob returns only
  `main.rs` and no dotfiles leak.
- `glob_includes_dotfiles_when_asked`: same tree, with
  `include_hidden: true`; asserts `.gitignore` IS present.

Existing tool tests updated to pass `include_hidden: false`
explicitly (the struct literal pattern requires all fields).
651 pass (was 649), 0 fail across all build profiles.

## Migration note

Users with workflows that relied on dotfile visibility need to
pass `include_hidden: true` in subsequent agent runs. Configured
permission rules are unaffected (they match against paths, not
dotfile-ness).
@yogthos
yogthos merged commit 9d67662 into main May 21, 2026
1 check passed
@yogthos
yogthos deleted the fix/f2-hide-dotfiles branch May 21, 2026 04:10
yogthos added a commit that referenced this pull request May 21, 2026
All actionable Track F items now landed:

- F-CRITICAL (PRs #76, #77): ACP perm asks routed to Deny, find/glob/list_dir hide dotfiles by default
- F-HIGH (PRs #78#84): compress aligns cut-point, read streams large files, ACP parallel tool ids, bash pgid cleanup, symlink canonicalize, session schema version, quote-aware bash splitter
- F-MEDIUM (PRs #85, #86, #87, #89, #90, #91): interleaved bash output, compress net-savings, Retry-After parsing, plugin docs, relative-path normalize, BOM strip, bounded interject channel
- F-SKIP (F9, F11, F15): verified false positives or N/A; rationale documented inline

Status legend updated; ordering recommendation replaced with the
shipped-status section.

Co-authored-by: Yogthos <yogthos@gmail.com>
allen-munsch pushed a commit to allen-munsch/dirge that referenced this pull request Jun 3, 2026
…code#77)

Track F-CRITICAL #2 from ROADMAP.md.

## Problem

All three filesystem-walking tools set `.hidden(false)` on the
`ignore::WalkBuilder`. Default behavior surfaced dotfiles to the
LLM:

- `.env` files — secrets in plaintext
- `.git/` internals — refs, hooks, blobs
- `.DS_Store` — macOS metadata noise
- `.netrc`, `.aws/credentials`, etc.

Agents reading the filesystem could silently pull these into chat
context. Security + privacy leak.

## Fix

New `include_hidden: bool` arg on `FindFilesArgs`, `GlobArgs`,
`ListDirArgs` with `#[serde(default)]` (defaults to false). Walker
calls become `.hidden(!args.include_hidden)`:

- `WalkBuilder::hidden(true)` means SKIP hidden entries.
- Default (`include_hidden=false`) → `.hidden(true)` → dotfiles
  skipped, matching pi + opencode defaults.
- LLM opts in via `include_hidden: true` when it explicitly needs
  to inspect a dotfile (e.g. checking `.gitignore` contents).

Schemas updated so the LLM sees the new arg with a description
explaining the safety rationale.

Cache keys include `:hidden=<bool>` so the same pattern with
different hidden flags doesn't collide.

## Tests

Two new tests in `agent::tools::glob::tests`:

- `glob_skips_dotfiles_by_default`: writes `.env`, `.gitignore`,
  `main.rs` to a temp tree; asserts default glob returns only
  `main.rs` and no dotfiles leak.
- `glob_includes_dotfiles_when_asked`: same tree, with
  `include_hidden: true`; asserts `.gitignore` IS present.

Existing tool tests updated to pass `include_hidden: false`
explicitly (the struct literal pattern requires all fields).
651 pass (was 649), 0 fail across all build profiles.

## Migration note

Users with workflows that relied on dotfile visibility need to
pass `include_hidden: true` in subsequent agent runs. Configured
permission rules are unaffected (they match against paths, not
dotfile-ness).

Co-authored-by: Yogthos <yogthos@gmail.com>
allen-munsch pushed a commit to allen-munsch/dirge that referenced this pull request Jun 3, 2026
…irge-code#92)

All actionable Track F items now landed:

- F-CRITICAL (PRs dirge-code#76, dirge-code#77): ACP perm asks routed to Deny, find/glob/list_dir hide dotfiles by default
- F-HIGH (PRs dirge-code#78dirge-code#84): compress aligns cut-point, read streams large files, ACP parallel tool ids, bash pgid cleanup, symlink canonicalize, session schema version, quote-aware bash splitter
- F-MEDIUM (PRs dirge-code#85, dirge-code#86, dirge-code#87, dirge-code#89, dirge-code#90, dirge-code#91): interleaved bash output, compress net-savings, Retry-After parsing, plugin docs, relative-path normalize, BOM strip, bounded interject channel
- F-SKIP (F9, F11, F15): verified false positives or N/A; rationale documented inline

Status legend updated; ordering recommendation replaced with the
shipped-status section.

Co-authored-by: Yogthos <yogthos@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant