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

Extra check for incompatible options #63

Closed
XhmikosR opened this issue Feb 6, 2020 · 6 comments · Fixed by #64
Closed

Extra check for incompatible options #63

XhmikosR opened this issue Feb 6, 2020 · 6 comments · Fixed by #64
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@XhmikosR
Copy link
Contributor

XhmikosR commented Feb 6, 2020

Is your feature request related to a problem? Please describe.

#23 (comment)

> nodejs.org@ test:lint:lockfile C:\Users\xmr\Desktop\nodejs.org
> lockfile-lint --allowed-hosts npm github.com --allowed-schemes "https:" "git+https:" --empty-hostname false --validate-https --type npm --path package-lock.json

detected invalid protocol for package: metalsmith-permalinks@git+https://github.com/segmentio/metalsmith-permalinks.git#432843d5823a292b2e47397ba46fd761d03eb9d3
    expected: https:
    actual: git+https:

error: command failed with exit code 1

Describe the solution you'd like

Since the above works without the validate-https flag, maybe there should be some checks in place for potentially incompatible options.

@lirantal lirantal added enhancement New feature or request good first issue Good for newcomers labels Feb 6, 2020
@lirantal
Copy link
Owner

lirantal commented Feb 6, 2020

@XhmikosR totally agree and have been on my mind as well.
It should also be straightforward to do with yargs configuration options. You can detect if both are being used and then fail, or better yet, in my opinion schemes should override https.

Would you like to submit a PR for this?

@XhmikosR
Copy link
Contributor Author

XhmikosR commented Feb 7, 2020 via email

@lirantal
Copy link
Owner

lirantal commented Feb 7, 2020

No worries at all, I'll shoot in a PR for that soon enough and ping you then ❤️

@lirantal lirantal self-assigned this Feb 8, 2020
@lirantal
Copy link
Owner

lirantal commented Feb 8, 2020

@XhmikosR how does this look like:

$ lockfile-lint --path package-lock.json --type npm --allowed-hosts npm github.com --allowed-schemes https: github: --empty-hostname false --validate-https
Arguments o and validate-https are mutually exclusive

Usage: lockfile-lint --path <path-to-lockfile> --allowed-hosts yarn npm

Options:
  --version              Show version number                           [boolean]
  --help, -h             Show help                                     [boolean]
  -p, --path             path to the lockfile                [string] [required]
  -t, --type             lockfile type, options are "npm" or "yarn"     [string]
  -s, --validate-https   validates the use of HTTPS as protocol schema for all
                         resources                                     [boolean]
  -e, --empty-hostname   allows empty hostnames, or set to false if you wish for
                         a stricter policy             [boolean] [default: true]
  -a, --allowed-hosts    validates a whitelist of allowed hosts to be used for
                         resources in the lockfile                       [array]
  -o, --allowed-schemes  validates a whitelist of allowed schemes to be used for
                         resources in the lockfile                       [array]

Examples:
  lockfile-lint --path yarn.lock --validate-https
  lockfile-lint --path yarn.lock --validate-https --allowed-hosts npm yarn
  verdaccio
  lockfile-lint --path yarn.lock --allowed-schemes "https:" "git+ssh:"
  --allowed-hosts npm yarn verdaccio

curated by Liran Tal at https://github.com/lirantal/lockfile-lint

Arguments o and validate-https are mutually exclusive

@XhmikosR
Copy link
Contributor Author

@lirantal yup, that works!

@lirantal
Copy link
Owner

Great. Merging away 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants