-
Notifications
You must be signed in to change notification settings - Fork 112
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 security access headers for ocdav requests #780
Conversation
284fc34
to
1c5f32e
Compare
@@ -134,3 +138,8 @@ func (s *svc) handleGet(w http.ResponseWriter, r *http.Request, ns string) { | |||
log.Error().Err(err).Msg("error finishing copying data to response") | |||
} | |||
} | |||
|
|||
// Rawurlencode https://www.php2golang.com/method/function.rawurlencode.html | |||
func Rawurlencode(str string) string { |
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.
Why the url.QueryEspace is not enough?
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.
oc10 encodes filename in Content-Disposition
header with PHP's rawurlencode
function. The difference between rawurlencode
and url.QueryEscape
is url.QueryEscape
encodes spaces as +
instead of %20
. I added this function to ensure consistency with oc10.
I found url.PathEscape
is also working in same way. So, now url.PathEscape
has been used instead of this function with the last commit.
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.
@karakayasemi in that case, as youre' doing path.Base there no need to call url.PathEscape
as there isn't a path. Base gives you the basename of the path.
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.
Yes, you are right. Redundant url.PathEscape
has been removed.
1c5f32e
to
7b3d873
Compare
Hi @karakayasemi , take a look at the following page for default security configurations: If we are providing some defaults, let's make sure they are aligned with the propositions above. |
7b3d873
to
105bfc7
Compare
The only conflicting part that I see is the age of |
2be076c
to
56b8838
Compare
56b8838
to
176060a
Compare
Adds necessary security headers for ocdav requests.
For owncloud/ocis-reva#66