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

lockfile-lint failed parsing a URL object from given host value so using as is #138

Closed
glensc opened this issue Sep 23, 2022 · 4 comments · Fixed by #139
Closed

lockfile-lint failed parsing a URL object from given host value so using as is #138

glensc opened this issue Sep 23, 2022 · 4 comments · Fixed by #139
Assignees
Labels
bug Something isn't working

Comments

@glensc
Copy link

glensc commented Sep 23, 2022

Expected Behavior

Current Behavior

Updated from "lockfile-lint": "^3.0.1" to "lockfile-lint": "^4.8.0"

And getting errors like:

+ export 'DEBUG=*'
+ lockfile-lint --validate-https '--allowed-hosts=npm.example.net' '--path=yarn.lock'
2022-09-22T18:24:54.891Z lockfile-lint parsed the following options: {"_":["/usr/local/bin/node","/usr/bin/lockfile-lint"],"validate-https":true,"s":true,"validateHttps":true,"allowed-hosts":["npm.example.net"],"a":["npm.delfi.net"],"allowedHosts":["npm.example.net"],"path":"yarn.lock","p":"yarn.lock","e":true,"empty-hostname":true,"emptyHostname":true,"f":"pretty","format":"pretty","$0":"/usr/bin/lockfile-lint"}
2022-09-22T18:24:54.892Z lockfile-lint invoking validator for: validateHttps
2022-09-22T18:24:54.893Z lockfile-lint validate-host-manager invoked with validator options: true
2022-09-22T18:24:55.163Z lockfile-lint validator validateHttps reported no issues
2022-09-22T18:24:55.163Z lockfile-lint invoking validator for: validateHosts
2022-09-22T18:24:55.163Z lockfile-lint validate-host-manager invoked with validator options: ["npm.example.net"]
2022-09-22T18:24:55.433Z lockfile-lint failed parsing a URL object from given host value so using as is: npm.example.net

the failed parsing a URL is printed like 1000 times. I guess for every item in yarn.lock file.

Possible Solution

Roll back to 3.0.1 version.

Steps to Reproduce (for bugs)

  1. yarn add lockfile-lint@4.8.0
  2. export 'DEBUG=*'
  3. lockfile-lint --validate-https '--allowed-hosts=npm.example.net' '--path=yarn.lock'

Context

Your Environment

  • Library Version used: 4.8.0
  • Node.js version (e.g. Node.js 5.4): 16
  • Operating System and version (desktop or mobile): desktop
@lirantal
Copy link
Owner

Hi @glensc, thanks for reporting the issue.
Can you please provide a reference lockfile so I can reproduce the issue?

@lirantal lirantal self-assigned this Sep 26, 2022
@lirantal lirantal added the bug Something isn't working label Sep 26, 2022
@lirantal
Copy link
Owner

Ok, I was able to reproduce locally. Indeed the update to use new URL() and parse the host from it isn't strictly needed for the validate-host option which uses hosts, and not URLs, hence this noisyness debug level isn't relevant to print an error about.

I'm pushing a fix for it.

@glensc
Copy link
Author

glensc commented Sep 26, 2022

@lirantal
Copy link
Owner

Fix added in 4.9.1 but you should indeed just get the latest. Let me know if there are still any lingering issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants