lockfile-lint: How to add exception to allow e.g. `git+ssh://git@gitlab.foo.bar`
For --allowed-hosts, how to allow also a specific git+ssh://git@gitlab.foo.bar source?
This would also have to work with the option to require https.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 1
- Comments: 24 (15 by maintainers)
Commits related to this issue
- feat: add URL validator address #39, #11 — committed to bolatovumar/lockfile-lint by bolatovumar 4 years ago
- feat: add URL validator address #39, #11 — committed to bolatovumar/lockfile-lint by bolatovumar 4 years ago
- feat: add URL validator address #39, #11 — committed to bolatovumar/lockfile-lint by bolatovumar 4 years ago
Addressed in https://github.com/lirantal/lockfile-lint/pull/52
I would like to see
--alowed-uri-prefixor--allowed-uri-patternoption, as it would allow to for example whitelist packages hosted in private repos, e.g.:@lirantal Sure. Added my 2 cents to #39.
@ixti can you jmp over to https://github.com/lirantal/lockfile-lint/issues/39 to discuss? I’m wondering if just changing the current behavior of
--allowed-hostswill be enough to cover this.Alrighty, let’s leave out allowed-uri for now as I think we have a plan around allowed schemes and allowed hosts updates and that should work well for now. We can work out allowed uri in future PR.
Regarding your question about a practical example, here are a couple:
npm’spackage-lock.json:yarn’syarn.lock:On the
scheme/protocol- I think either would be fine; perhaps per https://tools.ietf.org/html/rfc7320 ,schemeis more precise. Very minor topic though.I agree on
authorityandfragmentperhaps only being useful forgit+ssh, but thought to suggest that since, in the future, other schemes might arise, so this would be flexible to adapt. Just a suggestion; this can be made to work many different ways.As a really simple way to offer the flexibility we’re looking for here in terms of letting developers use this tool even on projects that have, for example, dep’s on github.com projects, perhaps the commandline option could support something like,
--allowed-uriand then the user just supplies the complete uri (inclusive of course to any url). So that way, only one single, dead-simple parameter would need to be added tolockfile-lint.I have actually aligned with the syntax used by Node.js’s URL API: https://nodejs.org/api/url.html#url_url_protocol - though perhaps worth to use the universal language for it instead of the object keys.
Indeed not sure how authority and fragment will only be relevant for specific schemes so I’m not 100% on those. Agree with
--validate-httpsstaying as-is.I actually had to make a change though, since right now we’re validating the
--allowed-hostsas complete origins, meaningnpmvalidateshttps://registry.npmjs.org- so the scheme is derived from it however I’m going to change that so that it matches the host only.so I’m thinking you could whitelist such URLs in this way:
If you only want to lint based on the hostname:
notice that with the change I’m thinking about,
--allowed-hosts yarn github.comwill only match the actual hosts such as:registry.npmjs.organdgithub.com. To also enforce HTTPS now you’ll need to explicitly opt-in to itIf you want to lint based on the hostname and enable https
WDYT?
That’s a good point. What would be the use-case we’d want to support? a specific one-off complete URL as a source? such as something like
git+ssh://lirantal@github.com/lirantal/lockfile-lint.git#1234567890or would you want to only match the protocolgit+ssh?