-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add storage permissions to UserDetail #511
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks pretty good to me. BTW some of these permissions don't correspond 1:1 to Capsicum rights. For example, GET and LIST would both require CAP_READ but nothing else. So the storage backend itself will also have to validate rights. But it would have to do that anyway, if we want the rights to be enforced on !FreeBSD.
Do you want a permission like STAT that allows the SIZE and MDTM commands? Or should they come along with LIST?
b71a2cb
to
aa56544
Compare
aa56544
to
709eb7b
Compare
ping. What does this PR still need? |
Hey sorry @asomers , I've been so focussed on the book I'm writing I've neglected and forgotten about this. Will try to attend to it in the next couple of days. |
This extends the UserDetail trait with a storage_permissions method that allow storage back-ends to limit what a user can do.
709eb7b
to
cd91390
Compare
Related PR: #503 |
The problem here is that this introduces a breaking change as such that all storage back-ends will need to be updated to make use of this, even the ones we don't have control over. |
Is it really a breaking change? Will the default implementation of |
If a user implementation is passed in that returns something other than the default, full access implementation, then storage back-ends that don't handle this don't behave correctly. I wonder if we can a UserDetail implementation with this functionality specifically in the filesystem back-end? I think you only rely on that right? At least for now to unblock you. How are you using this functionality, do you have your own FTP server that uses libunftp or do you want to eventually extend unFTP? |
Oh, I get it. Should we enforce these rights in libunftp itself then? Instead of the storage backend? That would fix the backwards-compatibility problem.
The filesystem backend? Yes, I'm using that. Are you suggesting adding a UserDetail implementation just for purposes of testing the necessary backend changes?
I have my own FTP server based on crates/unftp-sbe-fs/examples/cap-ftpd.rs . |
Would still be nice if this can be externally decided in a https://crates.io/crates/unftp-sbe-restrict way to keep libunftp core small |
This extends the UserDetail trait with a storage_permissions method that allow storage back-ends to limit what a user can do.