Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: gulpjs/glob-parent
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v6.0.0
Choose a base ref
...
head repository: gulpjs/glob-parent
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v6.0.1
Choose a head ref
  • 4 commits
  • 4 files changed
  • 3 contributors

Commits on May 3, 2021

  1. chore: Run prettier

    phated authored and actions-user committed May 3, 2021
    Copy the full SHA
    3ad9597 View commit details

Commits on Jul 20, 2021

  1. Verified

    This commit was created on github.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    3e9f04a View commit details
  2. chore: Run prettier

    phated authored and actions-user committed Jul 20, 2021
    Copy the full SHA
    8cdac1e View commit details
  3. chore: release 6.0.1 (#52)

    Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
    github-actions[bot] authored Jul 20, 2021

    Verified

    This commit was created on github.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    e1a15e1 View commit details
Showing with 54 additions and 9 deletions.
  1. +11 −6 CHANGELOG.md
  2. +24 −2 index.js
  3. +1 −1 package.json
  4. +18 −0 test/index.test.js
17 changes: 11 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -4,22 +4,27 @@

- eliminate ReDoS ([#36](https://github.com/gulpjs/glob-parent/issues/36)) ([f923116](https://github.com/gulpjs/glob-parent/commit/f9231168b0041fea3f8f954b3cceb56269fc6366))

## [6.0.0](https://www.github.com/gulpjs/glob-parent/compare/v5.1.2...v6.0.0) (2021-05-03)
### [6.0.1](https://www.github.com/gulpjs/glob-parent/compare/v6.0.0...v6.0.1) (2021-07-20)


### Bug Fixes

* Resolve ReDoS vulnerability from CVE-2021-35065 ([#49](https://www.github.com/gulpjs/glob-parent/issues/49)) ([3e9f04a](https://www.github.com/gulpjs/glob-parent/commit/3e9f04a3b4349db7e1962d87c9a7398cda51f339))

## [6.0.0](https://www.github.com/gulpjs/glob-parent/compare/v5.1.2...v6.0.0) (2021-05-03)

### ⚠ BREAKING CHANGES

* Correct mishandled escaped path separators (#34)
* upgrade scaffold, dropping node <10 support
- Correct mishandled escaped path separators (#34)
- upgrade scaffold, dropping node <10 support

### Bug Fixes

* Correct mishandled escaped path separators ([#34](https://www.github.com/gulpjs/glob-parent/issues/34)) ([32f6d52](https://www.github.com/gulpjs/glob-parent/commit/32f6d52663b7addac38d0dff570d8127edf03f47)), closes [#32](https://www.github.com/gulpjs/glob-parent/issues/32)

- Correct mishandled escaped path separators ([#34](https://www.github.com/gulpjs/glob-parent/issues/34)) ([32f6d52](https://www.github.com/gulpjs/glob-parent/commit/32f6d52663b7addac38d0dff570d8127edf03f47)), closes [#32](https://www.github.com/gulpjs/glob-parent/issues/32)

### Miscellaneous Chores

* upgrade scaffold, dropping node <10 support ([e83d0c5](https://www.github.com/gulpjs/glob-parent/commit/e83d0c5a411947cf69eb58f36349db80439c606f))
- upgrade scaffold, dropping node <10 support ([e83d0c5](https://www.github.com/gulpjs/glob-parent/commit/e83d0c5a411947cf69eb58f36349db80439c606f))

### [5.1.1](https://github.com/gulpjs/glob-parent/compare/v5.1.0...v5.1.1) (2021-01-27)

26 changes: 24 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
@@ -6,7 +6,6 @@ var isWin32 = require('os').platform() === 'win32';

var slash = '/';
var backslash = /\\/g;
var enclosure = /[{[].*\/.*[}\]]$/;
var globby = /(^|[^\\])([{[]|\([^)]+$)/;
var escaped = /\\([!*?|[\](){}])/g;

@@ -24,7 +23,7 @@ module.exports = function globParent(str, opts) {
}

// special case for strings ending in enclosure containing path separator
if (enclosure.test(str)) {
if (isEnclosure(str)) {
str += slash;
}

@@ -39,3 +38,26 @@ module.exports = function globParent(str, opts) {
// remove escape chars and return result
return str.replace(escaped, '$1');
};

function isEnclosure(str) {
var lastChar = str.slice(-1);

var enclosureStart;
switch (lastChar) {
case '}':
enclosureStart = '{';
break;
case ']':
enclosureStart = '[';
break;
default:
return false;
}

var foundIndex = str.indexOf(enclosureStart);
if (foundIndex < 0) {
return false;
}

return str.slice(foundIndex + 1, -1).includes(slash);
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "glob-parent",
"version": "6.0.0",
"version": "6.0.1",
"description": "Extract the non-magic parent path from a glob string.",
"author": "Gulp Team <team@gulpjs.com> (https://gulpjs.com/)",
"contributors": [
18 changes: 18 additions & 0 deletions test/index.test.js
Original file line number Diff line number Diff line change
@@ -224,6 +224,24 @@ describe('glob2base test patterns', function () {

done();
});

it("should finish in reasonable time for '{' + '/'.repeat(n) [CVE-2021-35065]", function (done) {
this.timeout(1000);
gp('{' + '/'.repeat(500000));
done();
});

it("should finish in reasonable time for '{'.repeat(n)", function (done) {
this.timeout(1000);
gp('{'.repeat(500000));
done();
});

it("should finish in reasonable time for '('.repeat(n)", function (done) {
this.timeout(1000);
gp('('.repeat(500000));
done();
});
});

if (isWin32) {