plainblack.com
Username Password
search
Bookmark and Share

    
Goto page «Previous Page   1 2    Next Page»

Protecting File Assets

User knowmad
Date 2/6/2008 10:34 pm
Views 5366
Rating -2    Rate [
|
]
Previous · Next
User Message
knowmad

I need to find a way to protect files that does not just protect the friendly url but also protects the real file location. As you know, WebGUI::Asset::File's www_view method does a redirect to the storage location. At this point, there is no security.

I recall some discussions around this issue but do not remember if any workarounds or other ideas came out. Suggestions?

EDIT: After posting this message, I came across the following links:

    Wiki article by Martin - What to do if privileges on the uploads directory don't seem to work
     Bug Report by koen - modproxy to circumvent security on uploads

Martin's suggestion in his wiki entry worked for me, but I don't understand Graham's response that this technique imposes severe performance issues. 


Thanks,
William

----
Knowmad Technologies
http://www.knowmad.com



Back to Top
Rate [
|
]
 
 
JT
Check the wiki

JT
On Feb 6, 2008, at 10:34 PM, <william@knowmad.com> wrote:

knowmad wrote:

I need to find a way to protect files that does not just protect the friendly url but also protects the real file location. As you know, WebGUI::Asset::File's www_view method does a redirect to the storage location. At this point, there is no security.

I recall some discussions around this issue but do not remember if any workarounds or other ideas came out. Suggestions?


Thanks,
William

----
Knowmad Technologies
http://www.knowmad.com



http://www.plainblack.com/webgui/dev/discuss/protecting-file-assets


--

Plain Black&#44; makers of WebGUI
http://plainblack.com


Back to Top
Rate [
|
]
 
 
knowmad
Check the wiki

I was updating my original post as you responded. Could you respond to my question about the performance issues this technique brings up?

 

----
Knowmad Technologies
http://www.knowmad.com



Back to Top
Rate [
|
]
 
 
JT

Martin's answer in the wiki is the right answer 100%. If you want file protection, you turn it on.

As far as performance, here's the difference.

With modproxy only:

modproxy > return file

Going through webgui:

modproxy > modperl > look at .wgaccess > load session > connect to db > instanciate asset > check privs > return file

 As you can see a lot more goes on there. On a single request, you're not likely to notice the performance hit as this whole process has ben heavily optimized. However, on a busy site, you'll see the site perform slower than you would without it. It's certainly usable, or we wouldn't put it in there. But for most sites, there's no reason to take the performance hit.



Back to Top
Rate [
|
]
 
 
knowmad

Thanks for the detailed answer JT.

Now, let me throw out an idea. Could there be a way to allow for protection of some files through the above mechanism but let other files be served by the faster, mod_proxy method? Perhaps a custom File Asset that uses a different directory for storing it's files?

 

William 

----
Knowmad Technologies
http://www.knowmad.com



Back to Top
Rate [
|
]
 
 
JT
Anything is possible of course. But this isnt something i would likely want in the core, because it puts an unnecessary burden on the user. 

JT
On Feb 8, 2008, at 8:22 AM, <william@knowmad.com> wrote:

knowmad wrote:

Thanks for the detailed answer JT.

Now, let me throw out an idea. Could there be a way to allow for protection of some files through the above mechanism but let other files be served by the faster, mod_proxy method? Perhaps a custom File Asset that uses a different directory for storing it's files?

 

William 

----
Knowmad Technologies
http://www.knowmad.com



http://www.plainblack.com/webgui/dev/discuss/protecting-file-assets/4


--

Plain Black&#44; makers of WebGUI
http://plainblack.com


Back to Top
Rate [
|
]
 
 
knowmad
Anything is possible of course. But this isnt something i would likely want in the core, because it puts an unnecessary burden on the user.

Looking in WebGUI::Asset::File at the setStorageLocation method, it is using WebGUI::Storage. So I'll need to subclass both File.pm and Storage.pm in order to override the default storage location.

Would you accept a patch to core that would allow Storage's _makePath to accept an alternative directory for $node instead of always relying on $self->session->config->get("uploadsPath")? If I could pass in an alternate config setting via the create method, I'd be 90% of the way towards having a file asset that can store to a secure location. This alternate location would need to be handled by getPath() and delete() as well.

Now the next question is how hard will it be to retrieve the file from this alternate location? Or would the path be stored with the new asset so that this would not be an issue?

 

William 

----
Knowmad Technologies
http://www.knowmad.com



Back to Top
Rate [
|
]
 
 
martink
I have thought about this too lately. What if files viewable for
'Everyone' do not get a .wgaccess file. In that case no session will be
built and the only performance hit you suffer is the '-e .wgaccess'
check. A .wgaccess file doesn't make sense for Everyone-viewable files
anyway. I think such behaviour can be easily built into
WG::Storage->setPrivileges.

Martin

william@knowmad.com wrote:
> knowmad wrote:
>
> Thanks for the detailed answer JT.
>
> Now, let me throw out an idea. Could there be a way to allow for
> protection of some files through the above mechanism but let other
> files be served by the faster, mod_proxy method? Perhaps a custom File
> Asset that uses a different directory for storing it's files?
>
>  
>
> William
>
> ----
> Knowmad Technologies
> http://www.knowmad.com
>
>
>
> http://www.plainblack.com/webgui/dev/discuss/protecting-file-assets/4
> ------------------------------------------------------------------------
>
>
>
>  



Back to Top
Rate [
|
]
 
 
JT
It already short circuits for files with an Everyone viewable group.
On Feb 15, 2008, at 11:32 AM, <martin@oqapi.nl> wrote:
martink wrote:

I have thought about this too lately. What if files viewable for
'Everyone' do not get a .wgaccess file. In that case no session will be
built and the only performance hit you suffer is the '-e .wgaccess'
check. A .wgaccess file doesn't make sense for Everyone-viewable files
anyway. I think such behaviour can be easily built into
WG::Storage->setPrivileges.

Martin

william@knowmad.com wrote:
> knowmad wrote:
>
> Thanks for the detailed answer JT.
>
> Now, let me throw out an idea. Could there be a way to allow for
> protection of some files through the above mechanism but let other
> files be served by the faster, mod_proxy method? Perhaps a custom File
> Asset that uses a different directory for storing it's files?
>
>  
>
> William
>
> ----
> Knowmad Technologies
> http://www.knowmad.com
>
>
>
> http://www.plainblack.com/webgui/dev/discuss/protecting-file-assets/4
> ------------------------------------------------------------------------
>
>
>
>  



http://www.plainblack.com/webgui/dev/discuss/protecting-file-assets/6

--

Plain Black&#44; makers of WebGUI
http://plainblack.com


JT Smithph: 703-286-2525 x810fx: 312-264-5382
Create like a god. Command like a king. Work like a slave.


Back to Top
Rate [
|
]
 
 
knowmad
It already short circuits for files with an Everyone viewable group.

Does that mean that when we use Martin's technique of allowing the modperl server to serve images, the process you described above only happens if the file is protected? At which stage in that process does wG short-circuit everyone-viewable files?

 

William 

----
Knowmad Technologies
http://www.knowmad.com



Back to Top
Rate [
|
]
 
 
     Goto page «Previous Page   1 2    Next Page»



© 2012 Plain Black Corporation | All Rights Reserved