internal/mcp: unexport FileResourceHandler
Unexport our nice root-respecting local-filesystem resource handler. It's unclear how roots should interact with a resource handler that uses the local filesystem. All we know from the spec is that servers should "respect root boundaries during operations," but it's not clear how they can do that reliably if root changes are notifications, meaning there is no causality between a client changing a root and then asking the server for a file. (Maybe the server sees the new roots, maybe it doesn't.) The spec is loose about all this: it feels more like a sketch. No other SDK seems to devote much to providing a local helper, and those that do (Python) don't look at roots. Change-Id: Ia4d9abb9bc1a6450e1fc8e607df5d7bc6aa227e3 Reviewed-on: https://go-review.googlesource.com/c/tools/+/678855 Reviewed-by: Robert Findley <rfindley@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
parent
a07ce11b37
commit
b1eb3c8804
1 changed files with 2 additions and 2 deletions
|
|
@ -291,7 +291,7 @@ func (s *Server) readResource(ctx context.Context, ss *ServerSession, params *Re
|
|||
return res, nil
|
||||
}
|
||||
|
||||
// FileResourceHandler returns a ReadResourceHandler that reads paths using dir as
|
||||
// fileResourceHandler returns a ReadResourceHandler that reads paths using dir as
|
||||
// a base directory.
|
||||
// It honors client roots and protects against path traversal attacks.
|
||||
//
|
||||
|
|
@ -303,7 +303,7 @@ func (s *Server) readResource(ctx context.Context, ss *ServerSession, params *Re
|
|||
// Lexical path traversal attacks, where the path has ".." elements that escape dir,
|
||||
// are always caught. Go 1.24 and above also protects against symlink-based attacks,
|
||||
// where symlinks under dir lead out of the tree.
|
||||
func (s *Server) FileResourceHandler(dir string) ResourceHandler {
|
||||
func (s *Server) fileResourceHandler(dir string) ResourceHandler {
|
||||
return fileResourceHandler(dir)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue