Skip to content
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

File downloads should not use createObjectURL #318

Closed
andrewazores opened this issue Oct 7, 2021 · 0 comments · Fixed by #319
Closed

File downloads should not use createObjectURL #318

andrewazores opened this issue Oct 7, 2021 · 0 comments · Fixed by #319
Assignees
Labels
feat New feature or request

Comments

@andrewazores
Copy link
Member

andrewazores commented Oct 7, 2021

Requires backend support:

#319 (comment)
#319 (comment)

Currently, when downloading template XMLs, report HTMLs, or recording JFRs, the application handles firing the HTTP request with the appropriate Authorization header. The remote asset is then downloaded into memory as a blob, assigned an object data URL, and then that URL passed to the browser's native file save dialog to "download" - despite the fact that we have already downloaded the file from the server and are holding it entirely in-memory, without any progress bar or ability to cancel the download on the user's side.

This download flow should be replaced by a normal download flow handled by the browser, where the application simply points the browser at a URL to download from the server, and the browser continues to display a dialog to the user confirming the choice, showing progress in its Downloads indicator, and handling the actual data transfer and memory/disk management.

To do so will require some backend changes so that Authorization headers do not need to be passed with the GET request to download the assets. A Cryostat user session cookie could be used for this purpose, to authenticate a logged-in Cryostat user for the duration of their login session (ex. generate a token and send it back with Set-Cookie on POST /api/v2/auth?), or as in the blog posts linked in the above comments, there could be a very short-lived token generated for each specific asset download request, which the client must include as a query parameter to download the actual asset file on a subsequent request.

We can probably use JWTs for either user login tokens or for per-request download tokens - need to do more research here. https://github.com/auth0/java-jwt
https://vertx.io/docs/vertx-auth-jwt/java/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant