konveyor / move2kube-ui

An UI for interacting with Move2Kube API
https://move2kube.konveyor.io/
Apache License 2.0
10 stars 14 forks source link

bug: when running the UI on an IP address other than localhost without https, trying to upload files throws an error #135

Closed HarikrishnanBalagopal closed 1 year ago

HarikrishnanBalagopal commented 1 year ago

Bug

Overview

When trying to upload files in the UI we get an error saying that crypto.randomUUID is not a function. Only happens on insecure contexts like http and when not using localhost

Reason: https://developer.mozilla.org/en-US/docs/Web/API/Crypto/randomUUID

Secure context: This feature is available only in [secure contexts](https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts) (HTTPS), in some or all [supporting browsers](https://developer.mozilla.org/en-US/docs/Web/API/Crypto/randomUUID#browser_compatibility).

Steps to reproduce

  1. Run the UI docker container on a VM that has a IP address you can access
  2. Access the UI on that IP address using http like: http://1.2.3.4:8080/
  3. Try to upload a file.

Expected behavior

Should be able to upload the file without errors.

Actual behavior

We get an error like

{"name":"TypeError","message":"crypto.randomUUID is not a function","stack":"endpoints/e/<@http://x.x.x.x
....

Version info

CLI 
version: latest+unreleased
gitCommit: 672d08f45d53cd40b02822ecfade0a4c4fce9a13
gitTreeState: clean
goVersion: go1.18
platform: linux/amd64

API 
version: latest+unreleased
gitCommit: 67fd5820cad4122e5c6d79f67cd179db00397a2a
gitTreeState: clean
goVersion: go1.18
platform: linux/amd64
UI  
version: latest
gitCommit: bc5bfeed699f925119b928dd7c90ab4b370de3f6
gitTreeState: clean
Docker  
docker socket is not mounted

Additional context

Found by a user running Move2Kube on a VM and accessing it from their laptop because they don't have Docker installed.

HarikrishnanBalagopal commented 1 year ago

Fixed by #134