-
Couldn't load subscription status.
- Fork 62
Description
I'm attempting to add files with slashes in the name part of the DID; e.g.,
my_scope:some_directory/my-file. The reason is to allow people who are using the Zarr data format to store their data using Rucio. Quick summary: Zarr stores data in multiple files where the file names and relative paths are significant. The following is a few of the files from data stored using Zarr:[...] spatial_ref/0 spatial_ref/.zarray spatial_ref/.zattrs .zmetadata latitude/0 latitude/.zarray latitude/.zattrs .zattrsOne problem I've encountered stems from how the Rucio client/server API encodes DID within a request URL: as string concatenation with a
/separator. For example, the client encodes the DIDmy_scope:my_nameasmy_scope/my_namewithin the URL when making a request. This mostly works fine. The problem start when either the DID scope or DID name contains a/character. Simple concatenation leads to an ambiguity: does the DIDa/b/cin the request path have the scopea/bwith filec, or does it have the scopeawith the fileb/c?The ambiguity is broken by percent-encoding any
/-characters in the DID name (/-->%2F), somy_scope/a:some_directory/my-fileis encoded asmy_scope/a/some_directory%2Fmy-filein the request URL.Theoretically, percent-encoding a
/-character is correct and should allow the inclusion of a/without inferring the normal hierarchy semantics (which is what we want). However, percent-encoding/-character is very poorly handled by software: there are so many broken pieces of software out there that it's often hard to get this to work correctly.Apache httpd is one example of broken software.
The
AllowEncodedSlashesdirective controls the behaviour. The default behaviour (equivalent toAllowEncodedSlashes Offdirective) is to reject any request with%2Fwith a 404 response. Always.The
AllowEncodedSlashes Ondirective accepts such requests but decodes them; this is also arguable wrong, as it treats/and%2Fas equivalent, which they are not.The
AllowEncodedSlashes NoDecodedirective would (I believe) pass on the%2F(inmy_scope/a/some_directory%2Fmy-filefor example) to Werkzeug for blueprint-based routing (as used by Rucio). This would at least give Rucio server the chance to handle this situation, although it's not clear (to me, right now) whether this would actually work.I note that the rucio repo contains various example Apache configurations (e.g., in the devel Docker files) that include the
AllowEncodedSlashes Ondirective. This (I believe) is wrong, but I haven't reproduced the problem yet.Therefore, I think we should update the Apache configuration. I would suggest
AllowEncodedSlashes NoDecodeis the correct setting, but I haven't verified that this actually works for my use-case.
Originally posted by @paulmillar in #387
Additional info: https://httpd.apache.org/docs/2.4/mod/core.html