Conversation
SHAcollision
left a comment
There was a problem hiding this comment.
Hey xwid138:fix-authz thank you for bringing this up and coming up with a fix. 🙌
I left a comment for a different take of this fix that could equally solve the problem you exposed without opening up some possible unsafe behaviour.
| // return Ok(()); | ||
| // } | ||
| } else { | ||
| } else if method == Method::PUT { |
There was a problem hiding this comment.
Could potentially allow other writing methods like DELETE into non /pub/ paths.
Feels like this whole conditional is hacky, but it's kindda correct "as is". So we might simply want to change L123 and L128 messages to "Access to non-/pub/ paths is forbidden” so it is accurate for reads too. What do you think?
There was a problem hiding this comment.
That's true - my bad.
I suggest adding some unit tests to authz, just to be safe. Wdyt ?
edit: should we allow for OPTIONS method as well in case of /pub/ path ? Only GET and HEADER are allowed.
There was a problem hiding this comment.
Indeed, we should allow OPTIONS too, and yes, this will greatly benefit from some tests 😅
This reverts commit 4c3d638.
|
LGTM! Let me know if you'd like to add more to this PR ( Edit: looks like we need to adjust this test for the test suite to be happy pubky-core/pubky-sdk/bindings/js/pkg/tests/storage.ts Lines 163 to 187 in 9c99d07 |
|
Thanks for the review @SHAcollision . I'll work on this PR and add mentioned changes. I will re-request a review once it's ready. |
When reading a path not starting with
/pub/Homeserver responds withWriting to directories other than '/pub/' is forbiddenerror message which is confusing forGETrequests.After change: