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

fix(conventional-commits-parser): address CVE-2021-23425 #841

Merged
merged 4 commits into from
Sep 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"c8": "^7.1.2",
"chai": "^4.2.0",
"concat-stream": "^2.0.0",
"conventional-changelog-core": "^4.2.1",
"conventional-changelog-core": "file://./packages/conventional-changelog-core",
"coveralls": "^3.0.2",
"eslint": "^7.0.0",
"eslint-config-standard": "^16.0.1",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"repository": "unknown",
"repository": "http://unknown",
"version": "v2.0.0"
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"repository": "unknown",
"repository": "http://unknown",
"version": "v2.0.0"
}
6 changes: 5 additions & 1 deletion packages/conventional-changelog-core/lib/merge-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,11 @@ function mergeConfig (options, context, gitRawCommitsOpts, parserOpts, writerOpt
}
context.owner = context.owner || repo.user || ''
context.repository = context.repository || repo.project
context.repoUrl = /undefined/i.exec(browse) ? context.host : browse
if (repo.host && repo.project && repo.user) {
context.repoUrl = browse
} else {
context.repoUrl = context.host
}
}

context.packageData = pkg
Expand Down
5 changes: 4 additions & 1 deletion packages/conventional-commits-parser/lib/parser.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
'use strict'
const trimOffNewlines = require('trim-off-newlines')
const _ = require('lodash')

const CATCH_ALL = /()(.+)/gi
const SCISSOR = '# ------------------------ >8 ------------------------'

function trimOffNewlines (input) {
return input.replace(/^(?:\r|\n)+|(?:\r|\n)+$/g, '')
}

function append (src, line) {
if (src) {
src += '\n' + line
Expand Down
5 changes: 2 additions & 3 deletions packages/conventional-commits-parser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,12 @@
"logs"
],
"dependencies": {
"JSONStream": "^1.0.4",
"is-text-path": "^1.0.1",
"JSONStream": "^1.0.4",
"lodash": "^4.17.15",
"meow": "^8.0.0",
"split2": "^3.0.0",
"through2": "^4.0.0",
"trim-off-newlines": "^1.0.0"
"through2": "^4.0.0"
},
"scripts": {
"test-windows": "echo 'make work on windows'"
Expand Down