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

CB-14145: cordova-common update to resolve npm audit & other updates in patch release #451

Merged
merged 12 commits into from
Jul 11, 2018

Conversation

brodycj
Copy link
Contributor

@brodycj brodycj commented Jun 13, 2018

Platforms affected

Android

What does this PR do?

  • cordova-common 2.2.5 update (pinned) to resolve ugly npm audit and engine warning messages
  • pin other dependencies in this patch fix
  • completely reinstalled dependencies in node_modules using npm@6.1.0
  • update bundledDependencies, needed to support deprecated Node.js 4 in this patch fix
  • update cordova.js from cordova-js@4.2.4 with the following change in this patch fix (using local coho with Improve patch release support cordova-coho#176 for patch release support):
    • CB-9366 log error.stack
  • other changes requested by @raphinesse:
  • enable node 4 (again), needed to support minor release (no need: deprecated Node.js 4 is still allowed by engines rule in package.json; npm install & npm test are still covered by AppVeyor CI on deprecated Node.js 4)

resolves npm audit warnings & other issues in patch release as needed asap (before the next major release is ready)

What testing has been done on this change?

  • npm audit with npm@6.1.0 (latest version) shows 0 vulnerabilities
  • using cordova platform add brodybits/cordova-android#cordova-common-2-update to add platform to new Cordova project and test on Android device using cordova run android succeeds on the following Node.js versions:
    • deprecated Node.js 4 (npm 2.15.11)
    • Node.js 6 (npm 3.10.10)
    • Node.js 8 (npm 5.6.0)
    • Node.js 10 (npm 6.1.0)
  • npm test succeeds (along with some other tasks) on AppVeyor CI & Travis CI

Checklist

  • Reported an issue in the JIRA database
  • Commit message follows the format: "CB-3232: (android) Fix bug with resolving file paths", where CB-xxxx is the JIRA ID & "android" is the platform affected (with some exceptions).
  • Added automated test coverage as appropriate for this change.

@brodycj brodycj changed the title Enable node 4 (again) & cordova-common 2.2.3 update Enable node 4 (again) & cordova-common 2.2.3 update for minor release [WIP] Jun 13, 2018
@codecov-io
Copy link

codecov-io commented Jun 13, 2018

Codecov Report

Merging #451 into 7.1.x will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##            7.1.x     #451   +/-   ##
=======================================
  Coverage   43.95%   43.95%           
=======================================
  Files          17       17           
  Lines        1711     1711           
  Branches      318      318           
=======================================
  Hits          752      752           
  Misses        959      959

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0bd3309...f909f35. Read the comment docs.

@raphinesse
Copy link
Contributor

Why do we need the dependency update before unbundling the dependencies (and thus the next major release)?

@brodycj brodycj changed the title Enable node 4 (again) & cordova-common 2.2.3 update for minor release [WIP] Minor release items: cordova-common 2.2.3 update with node 4 enabled again Jun 13, 2018
@brodycj
Copy link
Contributor Author

brodycj commented Jun 13, 2018

Now tested as follows (see above for more details):

  • passes npm test on Travis CI
  • Using cordova platform add https://github.com/brodybits/cordova-android#cordova-common-2-update to add cordova-android with the proposed changes to new Cordova app results in an app that starts properly on Android (device)
  • Using cordova platform add https://github.com/brodybits/cordova-android#cordova-common-2-update to add cordova-android with proposed changes to cordova-sqlite-storage test suite results in app that passes cordova-sqlite-storage test suite on Android (device)

The proposed changes resolves the npm audit warning messages on a minor release.

@Menardi
Copy link
Contributor

Menardi commented Jun 18, 2018

@brodybits Why does this PR require re-enabling support for Node 4? This would break a number of waiting PRs which depend on Node 6+.

@dpogue
Copy link
Member

dpogue commented Jun 18, 2018

We can't drop support for node 4 in a minor version update, but I agree that we should keep master moving forward to the next major version.

@brodybits Can we do these updates for the next minor on top of the 7.1.x branch? That way we can simply delete node_modules entirely on master and not worry about introducing more conflicts into the pending PRs

@brodycj brodycj changed the title Minor release items: cordova-common 2.2.3 update with node 4 enabled again Minor release with cordova-common@2.2.x update, etc. WIP Jun 18, 2018
@brodycj
Copy link
Contributor Author

brodycj commented Jun 18, 2018

@brodybits Can we do these updates for the next minor on top of the 7.1.x branch?

Will do.

@brodycj brodycj changed the title Minor release with cordova-common@2.2.x update, etc. WIP CB-14145: Minor release with cordova-common@2.2.x update, etc. WIP Jun 19, 2018
@brodycj brodycj changed the base branch from master to 7.1.x June 19, 2018 16:47
@brodycj brodycj changed the title CB-14145: Minor release with cordova-common@2.2.x update, etc. WIP CB-14145: update to cordova-common@2.2.4 to resolve npm audit issues Jun 19, 2018
@brodycj brodycj changed the title CB-14145: update to cordova-common@2.2.4 to resolve npm audit issues CB-14145: update to cordova-common@2.2.4 to resolve npm audit issues in patch release Jun 19, 2018
@raphinesse
Copy link
Contributor

I've cherry-picked all code fix commits from master that I could identify.

@brodycj brodycj changed the title CB-14145: update to cordova-common@2.2.4 to resolve npm audit issues in patch release CB-14145: update to cordova-common@2.2.4 to resolve npm audit & other issues in patch release Jun 20, 2018
@brodycj
Copy link
Contributor Author

brodycj commented Jun 20, 2018

I've cherry-picked all code fix commits from master that I could identify.

Thanks @raphinesse, updated title yet again to reflect what we actually want to do in the patch release.

TBH I have some mixed feelings, though not major. In general I would rather avoid including other fixes when making a security related patch. For a security patch we want the least risk possible that something goes wrong and the "end" user decides to roll back.

I think the actual security risk is very low. In general I would rather keep it this way.

Another really strange thing is that f05e61d seems to have a MacBook-Pro.local address, not linked to any user on GitHub.

What do you think, any comments?

@brodycj
Copy link
Contributor Author

brodycj commented Jun 20, 2018

FYI the delay is because it is taking me much longer than I expected to resolve the npm audit issues on cordova-js which I would consider to be an upstream dependency. My apologies for the confusion.

/cc @jcesarmobile

@raphinesse
Copy link
Contributor

As a user, I'd be annoyed by a patch release not including fixes to my problems even though they are ready to ship.

I see your point however. Since you do the release, decide at your own discretion.

@brodycj
Copy link
Contributor Author

brodycj commented Jun 21, 2018

@raphinesse you convinced me about the first 2 commits you added:

  • f05e61d - CB-13923 (android) fix -1 length for compressed files
  • 5cd19a3 - CB-14127: (android) Move google maven repo ahead of jcenter

I am still not so convinced about the 3 commits:

I think it would be ideal to move the last 3 commits to a followup patch, not sure if it is worth the effort to split them out or not.

@brodycj brodycj force-pushed the cordova-common-2-update branch 2 times, most recently from 97babc4 to c14e0dc Compare June 21, 2018 04:49
@brodycj
Copy link
Contributor Author

brodycj commented Jun 21, 2018

@raphinesse I just updated the last 2 commits to reference the PRs they originated from and show what kind of scripts are affected.

(GitHub links to the PRs from the commits in master, would be nice to have the same kind of thing in the 7.1.x branch. To show what kind of scripts are affected would also be good for the patch release notes.)

I may just include all the fixes in the same patch release to streamline things. I think the npm audit issues will not lead to any real vulnerabilities, at least not yet:)

@raphinesse
Copy link
Contributor

I'd be happy to see these fixes in the upcoming release. I don't see why these changes should break anything. If things break, we'll fix them. I think you need to worry a bit less 😊

Christopher J. Brody added 2 commits July 4, 2018 05:37
@brodycj
Copy link
Contributor Author

brodycj commented Jul 4, 2018

I just pushed a complete rebase, with the following updates (see above for more details):

  • Update cordova.js from cordova-js@4.2.4 with the following (using local coho with Improve patch release support cordova-coho#176 for patch release support):
    • CB-9366 log error.stack
  • update to cordova-common@2.2.5
  • pin other dependencies in package.json
  • completely reinstalled dependencies in node_modules using npm@6.1.0
  • update bundledDependencies in package.json, needed by the deprecated node 4 version
  • include changes that were added by @raphinesse (with PR number added to the commit messages in the last 3 changes)

tested in Cordova project using deprecated Node.js 4 and other Node.js versions as stated above

npm audit with npm@6.1.0 (latest release) shows 0 vulnerabilities (as stated above)

@brodycj brodycj changed the title CB-14145: update to cordova-common@2.2.4 to resolve npm audit & other issues in patch release CB-14145: cordova-common update to resolve npm audit & other updates in patch release Jul 8, 2018
Copy link
Contributor

@raphinesse raphinesse left a comment

Choose a reason for hiding this comment

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

I don't see why we need separate commits for removing an adding node_modules contents. But then again I don't care too strongly about it.

It seems you listed each transitive dependency in bundledDependencies. According to this npm test we should not need to do that. Was there something that made this necessary?

Otherwise this looks good to me 👍

@brodycj
Copy link
Contributor Author

brodycj commented Jul 10, 2018

I don't see why we need separate commits for removing an adding node_modules contents.

As I explained in apache/cordova-windows#281 (comment): a combination of updated dependencies and npm from non-deprecated version of Node.js results in such a massive change to node_modules that it seems cleanest to remove old node_modules before making the update.

It seems you listed each transitive dependency in bundledDependencies. According to this npm test we should not need to do that. Was there something that made this necessary?

Yes, also explained in apache/cordova-windows#281 (comment): With node_modules installed by newer version of npm (comes with non-deprecated version of Node.js), additional libraries need to be listed to work on Node.js 4. We know that Node.js 4 is deprecated but should not be dropped in a patch release:-(

Thanks for checking, will probably merge this really soon.

Christopher J. Brody and others added 10 commits July 10, 2018 12:30
- android-versions@1.3.0
- nopt@3.0.1
- properties-parser@0.2.3
- q@1.4.1
- shelljs@0.5.3

(elementtree@0.1.6 was already pinned)
- ignore all contents of node_modules/.bin
- explicitly ignore some node_modules contents not needed
- ignore package-lock.json in 7.1.x only
(indirect production dependencies needed by deprecated Node.js 4.x)
This also checks that we have exactly 1.8 since nothing else works with
the Android SDK. The user facing error was updated accordingly.
@brodycj brodycj merged commit c26082d into apache:7.1.x Jul 11, 2018
@brodycj brodycj deleted the cordova-common-2-update branch July 11, 2018 22:57
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.

6 participants