-
Notifications
You must be signed in to change notification settings - Fork 48
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
PCHR-4046: Fix security vulnerabilities #2828
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This was referenced Aug 17, 2018
igorpavlov-zz
approved these changes
Aug 17, 2018
igorpavlov-zz
approved these changes
Aug 17, 2018
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR is about solving the security vulnerabilities in the node dependencies used across the repo.
This was achieved primarily via
npm audit fix
, and only if that failed by manually updating the dependencies.The focus was on getting 0 vulnerability issues on each "project" (= folder with
package.json
) whenever possible.Following is the list of projects
root
0 vulnerabilities left
No manual changes done
hrui
The
package.json
file was actually deleted, since after #2775 it became obsoleteorg.civicrm.bootstrapcivihr
0 vulnerabilities left
Upgraded to gulp v4
Had to manually update gulp to version 4
This is a smell of bad architecture. Any gulp task is being executed by the
gulp
in the hrcore extension, which had already been upgraded in #2804, while the other extensions only provide additional custom task to add to the standard build pipeline.So when an extension needs to
require('gulp')
in order to do things likegulp.src
, it should automatically require thegulp
in hrcore. Unfortunately hrcore is not a parent but a sibling of the other extensions, which can't then find itsgulp
. Hence the need for each extension to have its own copy of the task runnerThis problem will be solved by a later ticket where the "main"
gulp
will be moved outside hrcore and placed in the rootChanges to civihr.css
They are just about quotes being used when processing SASS where they weren't before
Additionally the stricter approach to glob patterns due to
gulp-sass-glob
led to the same outcome outlined in "uk.co.compucorp.civicrm.hrleaveandabsences"org.civicrm.reqangular
0 vulnerabilities left
Upgraded to gulp v4
See "org.civicrm.bootstrapcivihr"
Fixes to usage of
gulp-angular-templatecache
Removed trailing slashes
Couldn't figure out the reason, but with gulp v4 the paths to the templates files got a leading slash that didn't make possible for angular to find the template
Using the
transformUrl
function to remove the slash solved the issueUsed plugin option instead of manual fixes
The module where we store the templates is called
common.templates
, which is different than the default module the plugin would put them, called simplytemplates
.Before this PR, the module was renamed manually by replacing the string in the
modules/templates.js
fileTurns out that the plugin offers options to do just that
uk.co.compucorp.civicrm.hrleaveandabsences
0 vulnerabilities left
Upgraded to gulp v4
See "org.civicrm.bootstrapcivihr"
Changes to leaveandabsence.css
Switching from
gulp-sass-bulk-import
togulp-sass-glob
(see "hrcore" below) fixed the output of the minified fileWith the old module, this
resulted in the partials inside
outside-namespace/
to be imported twice (seems that by default it interpreted/*
as/**/*
)The new module is much more strict in terms of the glob format, and correctly excludes the
outside-namespace/
folder from the first@import
The only partial affected by this change is
outside-namespace/leave-calendar.scss
, which contains only the styling for.chr_leave-calendar__day-tooltip
.The tooltip had been tested to make sure it's still displayed correctly
uk.co.compucorp.civicrm.hrcore
1 vulnerability left.
This is very low priority since
Use
gulp-sass-glob
instead ofgulp-sass-bulk-import
gulp-sass-bulk-import
is a very old plugin that hasn't been updated in 3 years and as such contains plenty of vulnerability issues in its dependency treeAs such it has been replaced with
gulp-sass-glob
which is actively maintained and a no outstanding security issuesThe only difference between the two is that the latter plugin is stricter with the glob formatting (see "uk.co.compucorp.civicrm.hrleaveandabsences"), but other than that they're pretty much the same
Update to karma v3
Bumped the karma version to 3, the only breaking change is that they dropped support for node 4 (karma-runner/karma#3082) so it doesn't really affect us
build
task was executed on each extension after hrcore had been updated. No changes to the js/css dist file had been detected, except for the ones mentioned in this PR. All the tests were performed successfullyuk.co.compucorp.civicrm.hremails
Was: 45 vulnerabilities (2 low, 36 moderate, 7 high)
Now: 42 vulnerabilities left (1 low, 35 moderate, 6 high)
In
email-templates/
sub-folderWas: 164 vulnerabilities (45 low, 103 moderate, 16 high)
Now: 53 vulnerabilities (12 low, 36 moderate, 5 high)
Only
npm audit fix
had been used to fix what it was possible to automatically fix.There is no new version available of the
foundation-cli
package, and being this a dev tool that had been basically used once, the priority is very low