about securing downloads

25 views
Skip to first unread message

altusfolius

unread,
Jul 22, 2012, 10:35:22 AM7/22/12
to cork-d...@googlegroups.com
Hello,

I use Bottke-Cork to secure application. It runs good, thank you.

But I now play with upload. Secureing upload page is ok.

How to secure downloads ? How to secure this method for example ?

def download(filepath):
return bottle.static_file(filepath, root='fs')

Is it good to do ? :

def download(filepath):
session = bottle.request.environ.get('beaker.session')
aaa.require(fail_redirect='/login')
return bottle.static_file(filepath, root='fs')


Thank you very much

J.H


Federico Ceratto

unread,
Jul 24, 2012, 3:03:22 PM7/24/12
to cork-d...@googlegroups.com
On Sun, Jul 22, 2012 at 3:35 PM, altusfolius
<julien.ha...@gmail.com> wrote:

> How to secure downloads ? How to secure this method for example ?
>
> def download(filepath):
> return bottle.static_file(filepath, root='fs')

Hello Julien,

Adding "aaa.require(fail_redirect='/login')" does the trick.
I've added a static file download to the example at:

https://github.com/FedericoCeratto/bottle-cork/commit/10568a5a348caaac63792b706024d9195094f871#L1L-1

Thank you for using Cork,

--
Federico

altusfolius

unread,
Jul 26, 2012, 7:21:55 PM7/26/12
to cork-d...@googlegroups.com
Thank you, I'm going to see.

J.H

Reply all
Reply to author
Forward
0 new messages