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

wslview not openeing links with limited access #268

Closed
1 task done
marcinbjorn opened this issue Mar 3, 2023 · 5 comments
Closed
1 task done

wslview not openeing links with limited access #268

marcinbjorn opened this issue Mar 3, 2023 · 5 comments
Assignees
Labels
Bug This is either an issue that describes a bug or a PR that resolves a bug Status: Patched This is fixed and is part of a released version. Target: 4.x This is targeted to the 4.x release.

Comments

@marcinbjorn
Copy link

marcinbjorn commented Mar 3, 2023

Windows Version

Windows 10

Windows Build Number

19044

WSL Version

WSL 2

Distro Version

Ubuntu 20.04

WSL Utilities Version

4.1.1

Describe the bug

I'm trying to open websites with access control list limited only to few public IPs. I'm getting this error

wslview http://210.210.210.210
Start : This command cannot be run due to the error: The system cannot find the file specified.
At line:1 char:128
+ ... ystem.Text.Encoding]::GetEncoding(850); Start "http\210.210.210.210"
+                                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Start-Process], InvalidOperationException
    + FullyQualifiedErrorId : InvalidOperationException,Microsoft.PowerShell.Commands.StartProcessCommand

Edit:
Made temporary fix by commenting out body of function url_validator (line 461) and return 0

Edit2:
Found what was the issue, curl fail with error curl: (60) SSL certificate problem: self signed certificate flag --insecure solves issue

function url_validator {
 content=$(curl --head --insecure --silent "$*" | head -n 1)
 if [ -n "$content" ]; then
    return 0
 else
    return 1
 fi
}

Websites that I'm accessing have very high latency, in my case curling takes extra 1-2 seconds, I'm rather skip validation at all

Steps to Reproduce

wslview [ not existing website ]

Expected behavior

Whenever wslview sees http:// or https:// at the beginning of link it should trust user and open link without verifying it.

Additional context

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@marcinbjorn marcinbjorn added the Bug This is either an issue that describes a bug or a PR that resolves a bug label Mar 3, 2023
@phox4ever
Copy link

Checking the URL first also leads to a problem if a cli utility like drush is creating one-time login link. Dispatching a HEAD request on a one-time-use URL before opening will immediatly invalidate it. WSL view should be able to validate an URL (regex) without checking if it's returning any content. It should ideally be provided as an optional flag or at least be skippable.

@CoeJoder
Copy link

CoeJoder commented Apr 29, 2023

I am having the same problem. In my case, ProxMox (a hypervisor) generates one-time use noVNC links in my shell script for remote access, and I want to open those links using wslview. This used to work on old versions of wslview but now it's broken.
Eg.

wslview https://proxmox.local:8006/?console=kvm&novnc=1&vmid=100&vmname=mintbox

This generates the same error message as described in OP. After some testing, I see that wslview refuses to open any links which it deems as not leading to a valid website. I'm not sure why this behavior would ever be wanted.

WORKAROUND
Until this bug is fixed, I am avoiding wslview in my bash scripts by launching the browser directly with a separate Firefox profile (requires separate profile to avoid instance collision if browser main profile already open).
Eg.

"$(wslpath "C:\Program Files\Mozilla Firefox\firefox.exe")" -P "profile2" -url "https://proxmox.local:8006/" &>/dev/null &

@patrick330602
Copy link
Member

Add a new param in dev for wslview as -s, --skip-validation-check and will release as part of wslu 4.2.0.

@patrick330602 patrick330602 added Status: Pending Release This is fixed but not yet released. Target: 4.x This is targeted to the 4.x release. labels Nov 12, 2023
@JaZo
Copy link
Contributor

JaZo commented Jan 11, 2024

The fix for this issue does not address the one-time-use URL issue, so I've opened #301 for that.

@MakerTim
Copy link

MakerTim commented Jan 11, 2024

Checking the URL first also leads to a problem if a cli utility like drush is creating one-time login link. Dispatching a HEAD request on a one-time-use URL before opening will immediatly invalidate it. WSL view should be able to validate an URL (regex) without checking if it's returning any content. It should ideally be provided as an optional flag or at least be skippable.

You can strip the /login from drush uli as quick workaround.
wslview `drush uli --mail=tbiesenbeek@swis.nl | sed 's/\/login//'`

patrick330602 added a commit that referenced this issue Mar 10, 2024
fix: [#268] do not validate URL when skip flag is used
@patrick330602 patrick330602 added Status: Patched This is fixed and is part of a released version. and removed Status: Pending Release This is fixed but not yet released. labels Mar 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug This is either an issue that describes a bug or a PR that resolves a bug Status: Patched This is fixed and is part of a released version. Target: 4.x This is targeted to the 4.x release.
Projects
None yet
Development

No branches or pull requests

6 participants