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

Switch identifier to be taken from github_advisory_id #217

Merged
merged 5 commits into from
Mar 12, 2022
Merged

Switch identifier to be taken from github_advisory_id #217

merged 5 commits into from
Mar 12, 2022

Conversation

mobilutz
Copy link
Contributor

@mobilutz mobilutz commented Mar 7, 2022

Background:
Two of our allowlist entries changed their npm-number 4 times in the last 48 hours!!!

This is a BREAKING CHANGE as the identifier that is used to identify advisories is being changed from numerical npm-identifier to string github-identifiers e.g. GHSA-rvg8-pwq2-xj7q

Making this backward compatible is for couple of reasons not good:

  1. npm-identifiers are NOT constant
  2. npmjs.com does not use the identifiers in the url attribute of the json response
  3. mix of numerical and string identifiers would need to be supported (in my opinion)
  4. makes this package very complex

NOTE: I bases this change not on IBM:main but quinnturner:node-12 branch so it has some changes not related to the pull-request in it. That was needed to make tests 🟢 which they are now 😄

@quinnturner
Copy link
Member

quinnturner commented Mar 7, 2022

Is there a reason that this must be backwards incompatible? I certainly prefer using the GitHub identifiers, but it would be nice (not required) to have backwards compatibility. Also, I have to refresh my memory for identifiers used for Yarn & Yarn Berry.

@quinnturner quinnturner self-requested a review March 7, 2022 21:58
@quinnturner
Copy link
Member

Note, the tests are failing because of advisory warnings in audit-ci's dependencies. I'll see if I can squash them in main for you to merge into this PR.

@mobilutz
Copy link
Contributor Author

mobilutz commented Mar 7, 2022

Is there a reason that this must be backwards incompatible? I certainly prefer using the GitHub identifiers, but it would be nice (not required) to have backwards compatibility. Also, I have to refresh my memory for identifiers used for Yarn & Yarn Berry.

I first wanted to add both possibilities to use npm-numbers AND github-numbers, but since I currently can see that the npm-numbers are being changed many many times I opted against having this.

I am firstly trying to find a solution for my company to use the non-changing github-numbers and then maybe try to find a way to make it backward compatible.

FYI on the npm-number change. Two of our allowlist entries changed the npm-number 4 times in the last 48 hours!!! The GHSA-number stayed constant!!!

@quinnturner
Copy link
Member

If you can make the tests pass across Yarn, Yarn Berry, NPM 6, and NPM 7 with only GitHub identifiers, I will accept a non-backwards-compat PR 👍🏻

@mobilutz
Copy link
Contributor Author

mobilutz commented Mar 7, 2022

If you can make the tests pass across Yarn, Yarn Berry, NPM 6, and NPM 7 with only GitHub identifiers, I will accept a non-backwards-compat PR 👍🏻

@quinnturner The thing I could not get to work so far is the allowlist format "GHSA-UUID|example5>example4".
I will take a look at this tomorrow.

PS: I am not sure, if I can make NPM 6 work. It looks as all of the NPM requests are mocked and non are really going out, and I locally also don't have NPM 6 anymore to check how the json responses look. And I do not trust mocked responses where I manually change things 😉

@quinnturner
Copy link
Member

I can appreciate the mocking concern. I am going to update all of the mocks with the latest live version in my other PR. If it can pass those mocks, I am satisfied!

@mobilutz
Copy link
Contributor Author

mobilutz commented Mar 8, 2022

@quinnturner I rebased my changes on your node-12 branch, and now it seems things are green.

Of course it is now harder to really see what my changes are.
Here they are: https://github.com/IBM/audit-ci/pull/217/files/0416a0e04533b199ad4553a1ebf184b57de30bad..c8cd59816ba903c892ed6200a20db7e130d9dbf2

@mobilutz mobilutz changed the title [WIP] Switch identifier to be taken from github_advisory_id Switch identifier to be taken from github_advisory_id Mar 8, 2022
@mobilutz mobilutz marked this pull request as ready for review March 8, 2022 20:12
@quinnturner
Copy link
Member

I am still working on the base branch. The NPM 7+ algorithm has to be revised, which is taking some time since the resolution of dependencies is complicated in NPM 7+. I hope to have a solution by today or tomorrow.

@Stephen2
Copy link

Wanted to say thank you for everyone taking this on. 2nd time in a couple of days our vulns have been renumbered, and we take a hard line "Block builds" until it's resolved, so it's painful all round.

@mobilutz
Copy link
Contributor Author

Wanted to say thank you for everyone taking this on. 2nd time in a couple of days our vulns have been renumbered, and we take a hard line "Block builds" until it's resolved, so it's painful all round.

@Stephen2 We temporarily switched off our js-auditing.

@adamb-mcr
Copy link

@mobilutz we left our js auditing in place in our CI builds so we still get logs but by omitting a severity parameter it's not a blocking step in our pipelines.

@quinnturner
Copy link
Member

quinnturner commented Mar 11, 2022

Hi there, please rebase this PR off of the latest main 👍🏻

I am also in the process of writing a codemod to help migrate users from v5 to v6, including this PR.

lib/Model.js Outdated Show resolved Hide resolved
lib/Model.js Outdated Show resolved Hide resolved
lib/allowlist.js Outdated Show resolved Hide resolved
@mobilutz
Copy link
Contributor Author

Hi there, please rebase this PR off of the latest main 👍🏻

@quinnturner done

I am also in the process of writing a codemod to help migrate users from v5 to v6, including this PR.

That sounds very good. If you need support, you can ping me.

PS: I was suprised as how little needed to change in the end after your node-12 upgrade together with the npm-ouputs updates!

@quinnturner
Copy link
Member

quinnturner commented Mar 11, 2022

https://github.com/quinnturner/audit-ci-codemod, working on the CI and publishing to NPM.

It reads your configuration (configurable path), then performs an in-place update:

  1. Moving advisories, path-whitelist, and whitelist -> allowlist
  2. Looks up existing NPM advisory IDs, resolves them to the associated GitHub advisory ID, and updates all instances of the ID in your config

lib/Model.js Outdated Show resolved Hide resolved
lib/allowlist.js Outdated Show resolved Hide resolved
lib/allowlist.js Outdated Show resolved Hide resolved
test/Model.js Outdated Show resolved Hide resolved
test/Model.js Outdated Show resolved Hide resolved
test/yarn-config-file/audit-ci.json Outdated Show resolved Hide resolved
@mobilutz
Copy link
Contributor Author

@quinnturner Thanks for you feedback, I think I addressed everything.

@quinnturner quinnturner self-requested a review March 12, 2022 13:11
Copy link
Member

@quinnturner quinnturner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect, thank you for your efforts! I will release 6.0.0-beta.1, do some last minute checks, then follow up with 6.0.0

@quinnturner quinnturner merged commit 975ad34 into IBM:main Mar 12, 2022
@mobilutz mobilutz deleted the ll-use-github-ids branch March 12, 2022 19:12
@quinnturner
Copy link
Member

Released 6.0.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants