Keep-web flow » History » Version 4
Tom Clegg, 12/23/2015 09:51 PM
| 1 | 1 | Peter Amstutz | h1. Keep-web flow |
|---|---|---|---|
| 2 | |||
| 3 | 4 | Tom Clegg | (Note: this page is an alternate explanation of the authoritative docs at https://godoc.org/git.curoverse.com/arvados.git/services/keep-web#hdr-Authorization_mechanisms) |
| 4 | |||
| 5 | 1 | Peter Amstutz | Keep-web serves files from Keep collections as normal HTTP documents. |
| 6 | |||
| 7 | Considerations: |
||
| 8 | |||
| 9 | We are serving arbitrary files, which can include HTML files with Javascript. We don't want serve these files as regular documents from Workbench, because this would expose a cross-site-scripting (XSS) attack where the HTML page is loaded and executed with the credentials of the viewing user. |
||
| 10 | |||
| 11 | This is mitigated two ways: |
||
| 12 | |||
| 13 | # By serving files with "content-disposition: attachment" which tells the browser to open up the download dialog straight away and don't try to show the files. |
||
| 14 | # Using separate a separate domain for downloading, so the browser won't send workbench cookies. |
||
| 15 | |||
| 16 | This raises the challenge: how to provide the API token to keep-web to enable download? |
||
| 17 | |||
| 18 | 3 | Peter Amstutz | keepweb accepts an API token the following ways: |
| 19 | |||
| 20 | * With @Authorization: OAuth2@ header |
||
| 21 | * With @Authorization: Basic@ header |
||
| 22 | * With @?api_token=xxx@ query string |
||
| 23 | * With a cookie called @arvados_api_token@ |
||
| 24 | * With @/t=xxx/@ at the start of the path |
||
| 25 | |||
| 26 | Constraints: |
||
| 27 | # when doing a GET request, the API token must be either part of the request URI or a header (browser does not send the workbench cookie when keep-web is on a different domain) |
||
| 28 | # We want to hide the API token from the user unless it is a "sharing" link |