Skip to content

feat(harness): support path-scoped filesystem permissions - #3588

Closed
NewPeople-star wants to merge 1 commit into
agentscope-ai:mainfrom
NewPeople-star:feat/filesystem-path-permissions-3317
Closed

NewPeople-star wants to merge 1 commit into
agentscope-ai:mainfrom
NewPeople-star:feat/filesystem-path-permissions-3317

Conversation

@NewPeople-star

Copy link
Copy Markdown

AgentScope-Java Version

2.1.0-SNAPSHOT

Description

Applications currently have to disable file-writing tools entirely to prevent agents from changing workspace definitions. This adds the path-scoped permission rules proposed in #3317, so an application can deny write_file / edit_file on AGENTS.md or skills/** while retaining ordinary file access. No rules are installed by default.

  • Add ToolRuleMatcher for annotated tools and pass the invocation context through permission matching, while preserving existing two-argument ToolBase.matchRule overrides.
  • Check the same effective preset arguments and toolkit default context that execution uses.
  • Match filesystem paths with *, ?, and whole-segment **, using the execution workspace/namespace mapping. Cover UNC paths and lexical absolute-path aliases; reject unresolved parent-relative and Windows drive-relative paths when path rules apply.
  • Add unit and call/stream regression tests, plus aligned English and Chinese documentation.

This is a lexical policy for named tools, not a filesystem isolation boundary. It does not protect against symlinks, case aliases, shell access, or direct application writes.

Fixes #3317

Validation

  • 99 focused tests passed, including denied definition writes, allowed ordinary writes and reads, preset precedence, and runtime-context consistency.
  • mvn -B -T1 verify was attempted and stopped at two existing Windows symbolic-link privilege errors in DangerousPathBypassTest.
  • Completed the relevant Core + AG-UI + Harness reactor with mvn -B -T1 -pl agentscope-harness -am spotless:apply verify -Dmaven.test.failure.ignore=true to collect all results: 4,457 test executions, 4,428 passed, 3 failed/errored, and 26 skipped. The remaining failure is LocalFilesystemPersonalAssistantExampleTest.localFilesystem_filesPersistAcrossCalls. All three failures were reproduced on the unchanged base commit c2ff087; the Harness failure reproduces in the full suite but passes in isolation. The ignore flag was only used to continue validation, not to treat failed tests as passing.
  • Relevant module JAR and Javadoc generation completed; git diff --check passed.
  • Documentation: 13 tests passed and build validation passed. Broken-link output is unchanged from the existing baseline (2,208 links across 326 files).

Checklist

  • Code has been formatted with mvn spotless:apply
  • All tests are passing (mvn test) — existing failures documented above
  • Javadoc comments are complete and follow project conventions
  • Related documentation has been updated
  • Code is ready for review

@CLAassistant

CLAassistant commented Oct 15, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@NewPeople-star
NewPeople-star force-pushed the feat/filesystem-path-permissions-3317 branch from 262746d to 4b2e869 Compare October 17, 2026 07:10
@xzxiaoshan

Copy link
Copy Markdown
Collaborator

For guarding file modifications and operations — AGENTS.md, skills/**, and whatever content types agents may add in the future — I think the ToolCallInterceptor extension point merged in #3657 already covers this need: interceptors see every locally executed tool call's final merged arguments (including file paths) and can policy-deny it, so developers can freely implement this protection for any file or future content type according to their actual business requirements, without the framework hard-coding specific paths.

@xzxiaoshan xzxiaoshan added the TBD To Be Discuss label Oct 21, 2026
@NewPeople-star

Copy link
Copy Markdown
Author

Thanks for pointing me to #3657. I reviewed the merged interceptor implementation: it receives the final preset-merged arguments before local tool execution and supports policy denial, so applications can implement the AGENTS.md / skills/** protection motivating this PR there. I agree this is a better fit than adding another path-matching extension to the permission engine. Closing this PR in favor of that extension point. Thanks for the review!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

TBD To Be Discuss

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Option to keep workspace definition files (AGENTS.md, skills/, knowledge/, subagents/) read-only for agent tools

3 participants