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

Fallback to npm 6 when lockfileVersion is not parseable as an integer #8745

Merged

Conversation

deivid-rodriguez
Copy link
Contributor

This makes the following security update succeed (and correct the lockfileVersion field):

$ SECURITY_ADVISORIES='[{"dependency-name":"follow-redirects","patched-versions":[],"unaffected-versions":[],"affected-versions":["< 1.14.7"]},{"dependency-name":"follow-redirects","patched-versions":[],"unaffected-versions":[],"affected-versions":["< 1.14.8"]},{"dependency-name":"follow-redirects","patched-versions":[],"unaffected-versions":[],"affected-versions":["< 1.15.4"]}]'  bin/dry-run.rb npm_and_yarn "Foyin/Pavarazzi" --dir="/." --dep="follow-redirects" --security-updates-only --updater-options=grouped_updates_experimental_rules,record_ecosystem_versions,record_update_job_unknown_error --commit=834b5548237c9c2824088435bef5587057061d48 --cache=files

For example,

```
$ SECURITY_ADVISORIES='[{"dependency-name":"follow-redirects","patched-versions":[],"unaffected-versions":[],"affected-versions":["< 1.14.7"]},{"dependency-name":"follow-redirects","patched-versions":[],"unaffected-versions":[],"affected-versions":["< 1.14.8"]},{"dependency-name":"follow-redirects","patched-versions":[],"unaffected-versions":[],"affected-versions":["< 1.15.4"]}]'  bin/dry-run.rb npm_and_yarn "Foyin/Pavarazzi" --dir="/." --dep="follow-redirects" --security-updates-only --updater-options=grouped_updates_experimental_rules,record_ecosystem_versions,record_update_job_unknown_error --commit=834b5548237c9c2824088435bef5587057061d48 --cache=files
```

currently fails with

``
/home/dependabot/npm_and_yarn/lib/dependabot/npm_and_yarn/helpers.rb:16:in `>=': comparison of String with 2 failed (ArgumentError)
	from /home/dependabot/npm_and_yarn/lib/dependabot/npm_and_yarn/helpers.rb:16:in `npm_version_numeric'
	from /home/dependabot/npm_and_yarn/lib/dependabot/npm_and_yarn/helpers.rb:11:in `npm_version'
	from /home/dependabot/npm_and_yarn/lib/dependabot/npm_and_yarn/file_parser/json_lock.rb:27:in `details'
	from /home/dependabot/npm_and_yarn/lib/dependabot/npm_and_yarn/file_parser/lockfile_parser.rb:40:in `block in lockfile_details'
	from /home/dependabot/npm_and_yarn/lib/dependabot/npm_and_yarn/file_parser/lockfile_parser.rb:39:in `each'
	from /home/dependabot/npm_and_yarn/lib/dependabot/npm_and_yarn/file_parser/lockfile_parser.rb:39:in `lockfile_details'
	from /home/dependabot/npm_and_yarn/lib/dependabot/npm_and_yarn/file_parser.rb:112:in `build_dependency'
	from /home/dependabot/npm_and_yarn/lib/dependabot/npm_and_yarn/file_parser.rb:91:in `block (2 levels) in manifest_dependencies'
	from /home/dependabot/npm_and_yarn/lib/dependabot/npm_and_yarn/file_parser.rb:42:in `block (2 levels) in each_dependency'
	from /home/dependabot/npm_and_yarn/lib/dependabot/npm_and_yarn/file_parser.rb:41:in `each'
	from /home/dependabot/npm_and_yarn/lib/dependabot/npm_and_yarn/file_parser.rb:41:in `block in each_dependency'
	from /home/dependabot/npm_and_yarn/lib/dependabot/npm_and_yarn/file_parser.rb:39:in `each'
	from /home/dependabot/npm_and_yarn/lib/dependabot/npm_and_yarn/file_parser.rb:39:in `each_dependency'
	from /home/dependabot/npm_and_yarn/lib/dependabot/npm_and_yarn/file_parser.rb:84:in `block in manifest_dependencies'
	from /home/dependabot/npm_and_yarn/lib/dependabot/npm_and_yarn/file_parser.rb:76:in `each'
	from /home/dependabot/npm_and_yarn/lib/dependabot/npm_and_yarn/file_parser.rb:76:in `manifest_dependencies'
	from /home/dependabot/npm_and_yarn/lib/dependabot/npm_and_yarn/file_parser.rb:49:in `parse'
```

This change makes the security upgrade succeed.
@deivid-rodriguez deivid-rodriguez force-pushed the deivid-rodriguez/ignore-lockfile-version-not-integer branch 3 times, most recently from db1bd68 to 8a99793 Compare January 9, 2024 19:17
@deivid-rodriguez deivid-rodriguez enabled auto-merge (squash) January 9, 2024 19:24
@deivid-rodriguez deivid-rodriguez merged commit 9095f66 into main Jan 9, 2024
121 checks passed
@deivid-rodriguez deivid-rodriguez deleted the deivid-rodriguez/ignore-lockfile-version-not-integer branch January 9, 2024 19:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants