Repository navigation
Conversation
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
| if err != nil { | ||
| return nil, nil, err | ||
| } | ||
| for i := 0; i < len(qids)-1; i++ { |
There was a problem hiding this comment.
shouldn't f.File.Walk have verified this property? I've never seen a test before against TypeDIr like this?
There was a problem hiding this comment.
(from gemini) Done — removed qidType and the qids[i].Type != p9.TypeDir check in Walk, leaving that to the underlying p9 server and localfs.
| cur := full | ||
| var tail []string | ||
| for { | ||
| resolved, err := filepath.EvalSymlinks(cur) |
There was a problem hiding this comment.
Do we need to use the safe root path from newer Go here? Remember we should be at 1.27.
There was a problem hiding this comment.
(from gemini) Removed along with the other redundant per-operation wrappers on filter9PFile.
| if clean == "/" { | ||
| return "/", nil | ||
| } | ||
| root := fs.Filesystem.Root() |
There was a problem hiding this comment.
(from gemini) Done — removed resolvePath here and throughout FilterFS.
…espace
- Replace client's forked CPU9P implementation with hugelgupf/p9's
fsimpl/localfs (which includes {dev, ino} QID collision avoidance
and full SetAttr/WriteAt/Readdir/Remove/Lock parity).
- Restrict both 9P (NewFilter9P) and NFS (NewFilterFS) client exports
to only the client-side paths explicitly listed in -namespace by
default, permitting read-only traversal and filtered directory
listings on ancestor directories from / down to each mount point.
- Add -unsafe-export flag (default false) to cmds/cpu and cmds/decpu
and client.WithUnsafeExport(bool) option to restore exporting the
entire -root tree when needed.
- Add end-to-end 9P and NFSv3 wire tests (client/e2e_export_test.go)
and full cpud SSH + reverse port-forwarded 9P/NFS daemon tests
(server/server_linux_test.go).
Signed-off-by: Barret Rhoden <brho@google.com>
bb47b79 to
fc7f231
Compare
rminnich
left a comment
There was a problem hiding this comment.
can we find some way to NOT embed the private key. This is asking for trouble.
Maybe I'm missing something. But they're very easy to generate dynamically.
|
|
||
| // Create implements billy.Filesystem.Create. | ||
| func (fs *FilterFS) Create(filename string) (billy.File, error) { | ||
| if !fs.allow.canRemovePath(filename) { |
There was a problem hiding this comment.
This naming might confuse people. Why do things that create things call a function called canRemovePath? The user may be able to guess, but perhaps a different function name will help.
| func (f *fsCPIO) Root() string { | ||
| if len(f.mnts) > 0 { | ||
| return f.mnts[0].fs.Root() | ||
| } |
There was a problem hiding this comment.
not sure about this but we'll see how it works. What's special about [0]? Is it derived from something else?
| CAqTAoGAA6rHnhvE9nmrqI4vS3nwSYF5POhP3JjKQMGc5a3H96hf+eJjNihb0NR1 | ||
| fxHFQ8imFzZ5OxTZOdAJwmbYO1iMS2oJ2GwAG5eI9w+xyyEu+QrCffHGHdFas1+C | ||
| uJ2GbxWXZEXGMHS79KrHXMnAFPZLYotgH1v+eTJ631lfZVFCOms= | ||
| MIIEpAIBAAKCAQEA65C+hVpY5NbCsPziKjp3JQNJg/fixtxW84kfz790nCpiQx/b |
There was a problem hiding this comment.
how did we end up embedding a private/public key pair in here? The u-root mount9p command was just changed to use files? I am unsure about this change. A key embedded in source is the same as no key at all, should we just not have a key?
This PR replaces the client's forked
CPU9Pimplementation withhugelgupf/p9/fsimpl/localfsand restricts the client's 9P and NFS exports to only the paths specified in-namespaceby default:CPU9Pwithlocalfs.Attacher:CPU9Pcopy (client/cpu9p*.go,client/getattr_*.go,client/cpu_*.go) in favor ofgithub.com/hugelgupf/p9/fsimpl/localfs(companion PR: fsimpl/localfs: bring localfs to parity with u-root/cpu CPU9P hugelgupf/p9#130), gaining{dev, ino}QID collision avoidance while preserving fullSetAttr,WriteAt(O_APPEND), paginatedReaddir,Remove, andFcntlFlockparity.-namespaceby default:ParseBindRemotesto extract the client-side ("remote") paths from-namespace.NewFilter9P(p9.Attacherwrapper) andNewFilterFS(billy.Filesystem+billy.Changewrapper for NFS) that share anallowList:/down to each mount point allow read-only traversal (Walk/GetAttr/Stat/Lstat) and filteredReaddir/ReadDir(exposing only allowed child entries) so/tmp/cpuand bind mounts work seamlessly without exposing the rest of/in/tmp/cpu.-rootreturnos.ErrNotExist.-unsafe-exportflag (defaultfalse):-unsafe-exporttocmds/cpuandcmds/decpuandclient.WithUnsafeExport(bool)to restore the previous behavior of exporting the entire-rootdirectory tree when desired.