Skip to content

[Bug] Remote-spec UNRESTRICTED default backend passes arbitrary absolute paths through (read_file("/etc/passwd") reaches the host) #3258

Open

Description

@aiyili

Summary

Follow-up from the #3253 review: anchoring the root spellings (/, .) fixed the root-listing escape, but the UNRESTRICTED default backend in RemoteFilesystemSpec still passes any arbitrary absolute path straight through (LocalFilesystem.resolveUnrestricted — if (target.isAbsolute()) return target;), so in the default remote configuration:

The same threat model as #3253, but for every absolute path rather than the two root spellings. Out of scope for PR #3254 (which the review noted), tracked here separately.

Suggested direction (per the #3253 review)

The remote-spec default backend probably wants SANDBOXED/ROOTED resolution rather than UNRESTRICTED — the same construction the shared-mode branch of #3247 already uses (new LocalFilesystem(workspace, true, 10, null) re-roots absolute paths under the workspace and rejects ..). The open question for maintainers is the default-behavior impact: today remote-mode users can legitimately read host files outside the workspace via absolute paths, so switching the default backend's mode is a breaking change that may deserve an opt-in/opt-out flag (or follow the deprecation path).

Activity

  1. oss-maintainer commented on Sep 22, 2026

    @oss-maintainer
    Collaborator

    Issue Evaluation

    Category: bug (security / workspace containment) | Module: agentscope-harness | Status: Confirmed (verified against main @ ed77530a4)

    Root cause, per claim

    • LocalFilesystem.resolveUnrestricted returns an absolute path unchanged — if (target.isAbsolute()) { return target; } (agentscope-harness/src/main/java/io/agentscope/harness/agent/filesystem/LocalFilesystem.java:681-687); the mode is selected by the boolean in the constructor (:144-155, :185-199).
    • RemoteFilesystemSpec builds its default backend as new LocalFilesystem(workspace, false, 10, localNamespaceFactory) (.../filesystem/spec/RemoteFilesystemSpec.java:212), and false maps to LocalFsMode.UNRESTRICTED. Confirmed.
    • LocalFilesystemSpec defaults to LocalFsMode.ROOTED (.../filesystem/spec/LocalFilesystemSpec.java:61), so the escape is specific to the remote spec's default backend, exactly as reported.
    • CompositeFilesystem adds no containment of its own — routeForPath (.../filesystem/CompositeFilesystem.java:108-137) does prefix routing only, and ls (:199-218) / grep (:280-320) hand the path to the selected backend. So the containment guarantee is entirely up to the backend's mode.
    • glob_files(path="/") behaves the same way (same resolver). Confirmed.

    One correction / scope expansion the report does not cover: this is not read-only. write (CompositeFilesystem.java:230-237) and edit (:240-259) go through the same route-then-resolve chain, so under the default remote backend an agent-supplied absolute path can also write or modify files outside the workspace, not just enumerate them. That raises the severity above "information disclosure" and should be stated in the issue so the fix is not scoped to reads only.

    Not covered by the in-flight PRs

    Assessment and recommended direction

    The report's framing is right that switching the default backend to SANDBOXED/ROOTED is a behaviour change for anyone who currently reads host files by absolute path through a remote-spec agent, so the default flip needs a maintainer call. Two things would make that call cheaper:

    1. Surface the backend mode explicitly on RemoteFilesystemSpec (instead of the bare false positional arg at :212) so the choice is readable and a default value can be deprecated separately from the mechanism.
    2. Treat the write path as part of the same defect — a containment fix that only covers reads leaves write_file/edit_file as the escape hatch.

    No bot PR this tick: the change is a default-behaviour/security-policy decision owned by the harness maintainers, and #3247/#3254 already occupy the adjacent code. Reply /approve (if a specific direction is agreed) or /revise <direction> and a patch will be generated against main.


    Automated evaluation by github-manager-bot

  2. added
    bug
    area/harness
    on Sep 22, 2026
  3. oss-maintainer commented on Sep 25, 2026

    @oss-maintainer
    Collaborator

    Status: 72 h feedback window expired — no automated PR will be generated, the proposal window here is closed

    The evaluation above (5785888097, posted 2026-09-22T23:16:10Z) reached its 72-hour feedback limit at 2026-09-25T23:16:10Z. The thread contains no reply at all, let alone a line starting with an approve, revise or reject command, so per our workflow we skip PR generation and no competing PR will be filed from this proposal window. No action is needed from anyone.

    The fix path stays community-owned. PR #3254 by aiyili (fix(harness): contain CompositeFilesystem root ls/grep to the backend root, stacked on #3247) is still OPEN and unmerged at head c04290c1b8 (reviewDecision=REVIEW_REQUIRED, last updated 2026-09-24T12:42:58Z), so the change ships through it rather than through a bot-generated duplicate — and filing a second PR into the same seam now would be a collision, not a contribution. Two things have moved since the evaluation was written: PR #3247 was merged on 2026-09-24T10:15:27Z, and per that evaluation it shipped only the opt-in shared-workspace branch, leaving the default backend construction untouched; #3254 still covers only the two root spellings (/, .) on the composite listing path and does not reach the absolute-path resolver. So the scope recorded in the evaluation — arbitrary absolute paths still passing through the default remote backend, on the read and the write/edit side — is not closed by what landed.

    Standing this window down is a timing call, not a verdict on the report. The evaluation's conclusion was that the default flip is a behaviour change for anyone currently reading host files by absolute path through a remote-spec agent, which is a security-policy decision owned by the harness maintainers, not something a generated patch can decide. If the maintainers do want a first-party patch, saying so on this issue with a direction (revise with the chosen default, or an explicit go-ahead on the two steps named above: expose the backend mode on RemoteFilesystemSpec instead of the bare positional flag, and treat write/edit as part of the same defect) is enough to get a spec and a PR generated against current main. The window closing only means the bot stops waiting.

    Automated by github-manager-bot

  4. aiyili commented on Sep 26, 2026

    @aiyili
    ContributorAuthor

    Acknowledged — and a status sync from the #3254 author's side, since two of the moving parts you flagged are now updated:

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

    area/harnessbug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions