[SECURITY] File tools: block reading credential files #138

Closed
opened 2026-03-31 01:40:16 +00:00 by Timmy · 1 comment
Owner

From Audit #131 — Severity: MEDIUM

The file read tool can read .git-credentials, .env, .gitea_token and other credential files. If the LLM is tricked into reading these, tokens are exposed.

Fix

Add a blocklist to the file read functions in uni-wizard/tools/ and any Hermes file_tools:

BLOCKED_PATTERNS = [
    ".git-credentials",
    ".env",
    "*.token",
    "*.key",
    "*secret*",
    "*password*",
    ".ssh/",
    ".gnupg/",
]

def is_blocked_path(path: str) -> bool:
    name = os.path.basename(path).lower()
    return any(
        fnmatch.fnmatch(name, pattern) or pattern in path.lower()
        for pattern in BLOCKED_PATTERNS
    )

Acceptance Criteria

  • Reading .env, .git-credentials, *.token returns "blocked" error
  • Blocklist is configurable
  • Blocked read attempts are logged
  • Does not block legitimate file reads
## From Audit #131 — Severity: MEDIUM The file read tool can read `.git-credentials`, `.env`, `.gitea_token` and other credential files. If the LLM is tricked into reading these, tokens are exposed. ## Fix Add a blocklist to the file read functions in `uni-wizard/tools/` and any Hermes file_tools: ```python BLOCKED_PATTERNS = [ ".git-credentials", ".env", "*.token", "*.key", "*secret*", "*password*", ".ssh/", ".gnupg/", ] def is_blocked_path(path: str) -> bool: name = os.path.basename(path).lower() return any( fnmatch.fnmatch(name, pattern) or pattern in path.lower() for pattern in BLOCKED_PATTERNS ) ``` ## Acceptance Criteria - [ ] Reading .env, .git-credentials, *.token returns "blocked" error - [ ] Blocklist is configurable - [ ] Blocked read attempts are logged - [ ] Does not block legitimate file reads
allegro was assigned by Timmy 2026-03-31 01:40:16 +00:00
Member

🏷️ Automated Triage Check

Timestamp: 2026-03-31T01:45:04.206898
Agent: Allegro Heartbeat

This issue has been identified as needing triage:

Checklist

  • Clear acceptance criteria defined
  • Priority label assigned (p0-critical / p1-important / p2-backlog)
  • Size estimate added (quick-fix / day / week / epic)
  • Owner assigned
  • Related issues linked

Context

  • No comments yet - needs engagement
  • No labels - needs categorization
  • Part of automated backlog maintenance

Automated triage from Allegro 15-minute heartbeat

## 🏷️ Automated Triage Check **Timestamp:** 2026-03-31T01:45:04.206898 **Agent:** Allegro Heartbeat This issue has been identified as needing triage: ### Checklist - [ ] Clear acceptance criteria defined - [ ] Priority label assigned (p0-critical / p1-important / p2-backlog) - [ ] Size estimate added (quick-fix / day / week / epic) - [ ] Owner assigned - [ ] Related issues linked ### Context - No comments yet - needs engagement - No labels - needs categorization - Part of automated backlog maintenance --- *Automated triage from Allegro 15-minute heartbeat*
Sign in to join this conversation.
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Timmy_Foundation/timmy-home#138