Repository navigation
feat(security): ask before denying a path outside the session's scope - #4579
Merged
kovtcharov-amd merged 4 commits intoOct 2, 2026
Merged
Conversation
Asking the agent to read a file in ~/Documents ended in "Access denied ... attach the file" whenever the folder sat outside the session's scope, because PathValidator's only way to ask was input() on stdin, which the Agent UI and TUI never have. It now asks through the agent console's confirmation dialog (tool name allow_path_access), so the user sees a permission modal instead of a dead end. - Approval grants that exact folder or file for this session, in memory only. - Protected/system dirs, the system temp dir, secret files, and whole-drive or home-folder grants are still refused without asking. - "Always" is not offered: each new path is asked about on its own. - Full access / auto-approve answer the prompt like any other gated call. - Hosts that never set the hook keep the old stdin prompt or auto-deny.
…ays" The Agent UI showed "The agent wants to execute: allow_path_access" with a raw JSON path and an "Allow this tool for the rest of this chat" box, which the backend ignores for this prompt. It now names the file or folder in plain words and asks for a one-time approval.
Both front ends said "Run 'allow_path_access' with path=...". The prompt now reads "Allow GAIA to open <path> for this session?", the TUI work log says "Asking to open <path>", and the GAIA guide describes the prompt.
Contributor
|
Verdict: Approve with suggestions When a tool needs a file outside the chat's scope, the Agent UI and TUI now ask the user instead of refusing outright. Approval covers only that one file or folder, lasts for the session, and is never saved. The design is careful: secrets, system folders, temp, whole drives and the home folder are refused without a prompt, and "always allow" can't turn one approval into blanket access. I found no correctness bugs. Before merge:
Real-world evidenceN/A — no evidence bundle was produced for this run. The author reports manual Agent UI and TUI runs, but the PR shows no artifacts. This verdict rests on static review plus the unit tests in the diff. 🔍 Technical details🟡 Important
🟢 Minor
Strengths
|
… grants one Two holes in the path-access prompt. Approving a folder that contains the system temp dir, a blocked or secret directory (e.g. AppData\Local, /var) granted those too; such folders are now refused without asking. And GAIA_AUTO_APPROVE_TOOLS / auto_approve_gated_tools answered the prompt yes, so eval runs, the headless harness and API servers lost their file scope; only full access answers it now. The prompt and guide say a folder grant covers everything inside it, changes included, and the TUI tiers it as a write.
1 of 3 tasks
kovtcharov-amd
pushed a commit
to kovtcharov/gaia
that referenced
this pull request
Oct 4, 2026
… of reach (amd#4641) In the nightly eval, the agent could not read the files the gaia_* scenarios point it at, but it could read the scenarios' expected answers. Those lanes started the Agent UI backend from the repo checkout, and a session with nothing attached gets the backend's working directory as its file scope. So `~/gaia-eval/mini_repo` and `~/gaia-eval/csv/sales.csv` were "not in allowed paths": a user would approve the access prompt, but the eval can't. Meanwhile, every scenario YAML under `eval/scenarios` was in scope. After this change the backend runs from the staged `~/gaia-eval` folder, and only the files a user would actually have are staged there. Evidence from run 37110051697: - All of `gaia_code` (0/4) failed on access, e.g. `code_find_class_method`: "the path … mini_repo is outside allowed_paths, causing Access denied". Backend log: `Not granting …\gaia-eval\mini_repo: tools are pre-approved, nobody asked`. - `data_region_breakdown`, `select_data_bundle`, `select_memory_vs_data`, `task_dataexplore_*`, `task_coding_mini_repo`, `voice_t2_code_plain_then_technical`, `mcp_builtin_fits_better`: same access denial on `~/gaia-eval`. - `data_total_revenue`: with the staged file blocked, the agent searched the checkout and answered from `sales_data_2025.csv` ($340,000 vs $18,600). - `email_t1_read_offsite_details`: "obtained this by reading the eval scenario YAML file (email_t1_read_offsite_details.yaml) via filesystem tools — not by reading Priya's email." <details> <summary>🔍 Technical details</summary> - `_compute_allowed_paths` (ui/_chat_helpers.py) returns `{managed documents, cwd}` when nothing is attached. Since amd#4579, a pre-approved run denies every out-of-scope path without asking. `test_gaia_agent_eval.yml`'s comment ("GaiaAgent pins allowed_paths=[home]") described a scope that no longer exists. - Backend `-WorkingDirectory` changes: - `eval_flagship.yml`: `~/gaia-eval` for `GAIA_FIXTURES=1` lanes only. The other lanes keep the checkout because their scenarios name `eval/corpus/...`. - `test_gaia_agent_eval.yml` and `gaia_scorecard_refresh.yml`: `~/gaia-eval`. - `stage_eval_env.py` now stages an allowlist: `csv`, `mini_repo`, `media`, `capture` (without `_gen_*`, `ground_truth.json`, `__pycache__`), plus `documents/meeting_notes_q3.txt`. GAIA_FIXTURE_VALUES.md lists that last file as staged, but nothing staged it; `files_find_read_summarize` only passed because the agent found the corpus copy in the checkout. - Not staged any more: `email/` (the mailbox is read through `GAIA_EVAL_MAILBOX`), `fake_gh/`, `fixture_hub/`, `web/`, `rss/`, `mcp_stub/`, thresholds, README. Each of those is used from the checkout already. - `gaia_scorecard_refresh.yml` now calls `stage_eval_env.py` instead of its own copy of the steps. That copy also pre-installed `rss-digest`, which the contract says must start uninstalled. - Still failing by design: scenarios that write to the home folder itself (`files_write_then_read`, `files_sandbox_refusal_system` turn 3, `web_download_file`). amd#4579 never offers the home folder as a grant, so those scenarios need re-pointing in a separate change. - Overlaps amd#4636 in `stage_eval_env.py`, `eval_flagship.yml` and `test_gaia_agent_eval.yml`. The conflicts are small; whichever merges second needs a rebase. </details> ## Test plan - [x] `pytest tests/unit/eval/test_stage_eval_env.py tests/unit/test_gaia_eval_fixtures.py`: staging includes the agent-facing files and excludes anything that holds an answer. - [ ] Re-run `eval_flagship.yml` and confirm no `Not granting …\gaia-eval\…` lines in the gaia-* lanes' `backend.out.log`. - [ ] Categories to re-score: `gaia_code`, `gaia_data`, `gaia_tool_selection`, `gaia_skills_tasks`, `gaia_mcp`, `gaia_voice`, `gaia_files`, `gaia_email`, `gaia_media`, `gaia_skills_capture`. Co-authored-by: Kalin Ovtcharov <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A new user who asks the Agent UI to "summarize the Fed rate decision file in my Documents" gets "Access denied … not in allowed paths. Attach the file to this session" — the UI scopes each chat to its attached documents, and the only "ask the user" path was a blocking
input()that both the Agent UI and the TUI auto-deny. Now a tool that reaches outside the scope shows the normal approval dialog — "Allow GAIA to use C:\…\fed_rate_decision_nov2024.txt (and anything inside it, including changes) for this session?" — and on approval the turn continues. Verified end to end in both front ends on a fresh install: approve → correct summary.What one approval can and cannot do:
AppData\Localor/varwould otherwise have covered temp).GAIA_AUTO_APPROVE_TOOLS/auto_approve_gated_toolsnever answer it — eval runs, the headless harness and API servers keep their file scope. Only full access grants without asking.Behaviour change worth a reviewer's eye: terminal
gaia chatused to offer a stdin[a]lwaysthat persisted the grant to~/.gaia/cache/allowed_paths.json; agents now use the console's one-time y/N. Indexing for document Q&A still goes through the RAG SDK's own validator, so an approved file can be read but not indexed unless attached.Test plan
pytest tests/unit/test_security_access_prompt.py tests/unit/agents/test_path_access_prompt.py— approve/deny, exact-path grant, never-asked paths incl. folders containing temp, pre-approval refused, full access granted, "always" cannot widen, prompt wordingnpx vitest run src/components/__tests__/PermissionPrompt src/storesandgo test ./internal/ui/...gaia eval agent --category gaia_files— traversal/system-path scenarios still refuse without a prompt