GithubHelp home page GithubHelp logo

filelist's People

Contributors

der-on avatar furiouzz avatar mde avatar myconode avatar opravil-jan avatar tomhughes avatar veldsla avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

filelist's Issues

Prototype Pollution vulnerability in merge function

NexusIQ reports a security vulnerability (sonatype-2021-0457) with v1.0.3... "The filelist and utilities packages are vulnerable to Prototype Pollution. The merge function in the respective index.js and object.js files allows for access to object prototype properties. An attacker can exploit this to override the behavior of object prototypes, resulting in a possible Denial of Service (DoS), Remote Code Execution (RCE), or other unexpected behavior." It has been blocked for use with our applications, which is unfortunate because it's necessary for react to work. Please take a look! (Thanks in advance)

Insensitive case

Is it possible to add an option for insensitive case to include() et exclude() methods ?

Currently :

const FL = new FileList
FL.include('**/*.jpg', ) // Only accept .jpg

With insensitive case option :

const FL = new FileList
FL.include('**/*.jpg', { nocase: true }) // Accept .jpg, .JPG, .Jpg, etc...```

glob based matching broken on Windows

Quite simply, * and ** based matches fail to work on windows.

Ironically, this actually prevents the tests from running on windows, because the '*' character is used to find tests.

To reproduce the failure, simply modify the jake file to explicitly run the test file my name by editing this line:

this.testFiles.include('test/*.js');

and replace with this.testFiles.include('test/filelist.js');

Once the tests actually run on windows, the following test output will be displayed:

> yarn test
yarn run v1.22.17
$ jake test
Starting 'test'...
jake aborted.
AssertionError [ERR_ASSERTION]: 0 == 2
    at Task.path separator can be used by exclude (C:\Users\markg\Software\filelist\test\filelist.js:32:12)
    at Task.action (C:\Users\markg\Software\filelist\node_modules\jake\lib\test_task.js:173:22)
    at Task.run (C:\Users\markg\Software\filelist\node_modules\jake\lib\task\task.js:325:29)
    at processImmediate (internal/timers.js:464:21)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

The root problem is the use of path.normalize here, on the query, right before passing the pattern to minimatch:

pat = path.normalize(pat);

A quick test shows removing this normalization causes tests to pass. However, I think normalization is still needed for handling other path fixups, and instead the same fixup used by globSync should be used after normalization to switch back to Unix path separators.

I'll get a PR open shortly.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.