You've already forked agentic-coding-workflow
17 lines
689 B
Go
17 lines
689 B
Go
// permission.go 暴露 ACP fs/* method 的路径安全校验入口。
|
|
//
|
|
// 具体校验逻辑在 internal/acp/pathsafe 子包(与 handlers 子包共用同一实现,
|
|
// 详见 pathsafe 包注释)。
|
|
package acp
|
|
|
|
import (
|
|
"github.com/yan1h/agent-coding-workflow/internal/acp/pathsafe"
|
|
)
|
|
|
|
// ResolveSafePath 校验 requested 是否安全(在 cwd 内)。
|
|
// cwd 必须是绝对路径;requested 可以是绝对或相对(相对时基于 cwd 解析)。
|
|
// 返回校验通过后的绝对路径(含 symlink 解析);失败返回 CodeAcpFsPathOutsideWorktree。
|
|
func ResolveSafePath(cwd, requested string) (string, error) {
|
|
return pathsafe.ResolveSafePath(cwd, requested)
|
|
}
|