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

Remove dependency on Gulp #344

Closed
felixfbecker opened this issue Aug 28, 2016 · 20 comments
Closed

Remove dependency on Gulp #344

felixfbecker opened this issue Aug 28, 2016 · 20 comments
Milestone

Comments

@felixfbecker
Copy link

There is no reason why this depends on Gulp. Gulp brings in a lot of dependencies like vinyl-fs and in turn graceful-fs, which we dont need at all. All Gulp is used for is task registration, which orchestrator (undertaker for gulp 4) are used for.

Using yargs would do the job much better.

@davidgoli
Copy link

👍

@sdepold
Copy link
Member

sdepold commented Sep 14, 2016

I agree. Back then I thought it would be a funny an easy going idea but it turned out to be a nightmare instead. I'm all for it!

@davidgoli
Copy link

At the very least a short-term fix would involve upgrading gulp to silence the graceful-fs deprecation messages.

@tdreyno
Copy link

tdreyno commented Nov 16, 2016

Not to mention this! https://snyk.io/test/npm/sequelize-cli

@felixfbecker
Copy link
Author

@tdreyno This is a CLI tool, not something you expose via HTTP or something, and sequelize-cli doesn't use the minimatch globbing at all. There is no vulnerability here.

@tdreyno
Copy link

tdreyno commented Nov 28, 2016

Fair. I'm using automated security checking tools for node and it's complaining because of that, regardless of if the vector is real or not.

@andrew-cunliffe
Copy link

andrew-cunliffe commented Nov 28, 2016

This is a pain, we have been asked to run nsp check as part of our CI build, but this dependency is the only one flagging a problem and its a false positive on the check :(

👍 to remove gulp as a required dependency

nsp check
(+) 2 vulnerabilities found
┌───────────────┬────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│               │ Regular Expression Denial of Service                                                                                                                           │
├───────────────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│ Name          │ minimatch                                                                                                                                                      │
├───────────────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│ Installed     │ 2.0.10                                                                                                                                                         │
├───────────────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│ Vulnerable    │ <=3.0.1                                                                                                                                                        │
├───────────────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│ Patched       │ >=3.0.2                                                                                                                                                        │
├───────────────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│ Path          │ ........ > sequelize-cli@2.4.0 > gulp@3.9.1 > vinyl-fs@0.3.14 > glob-stream@3.1.18 > minimatch@2.0.10                                          │
├───────────────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│ More Info     │ https://nodesecurity.io/advisories/118                                                                                                                         │
└───────────────┴────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
┌───────────────┬────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│               │ Regular Expression Denial of Service                                                                                                                           │
├───────────────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│ Name          │ minimatch                                                                                                                                                      │
├───────────────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│ Installed     │ 0.2.14                                                                                                                                                         │
├───────────────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│ Vulnerable    │ <=3.0.1                                                                                                                                                        │
├───────────────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│ Patched       │ >=3.0.2                                                                                                                                                        │
├───────────────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│ Path          │ ........ > sequelize-cli@2.4.0 > gulp@3.9.1 > vinyl-fs@0.3.14 > glob-watcher@0.0.6 > gaze@0.5.2 > globule@0.1.0 > minimatch@0.2.14             │
├───────────────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│ More Info     │ https://nodesecurity.io/advisories/118                                                                                                                         │
└───────────────┴────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘

@felixfbecker
Copy link
Author

nsp allows to exclude certain packages iirc. Especially since sequelize-cli is a devdep...

@eddiejaoude
Copy link
Contributor

eddiejaoude commented Nov 28, 2016

sequelize-cli is a Dev Dep? Doesn't state that in the docs. Otherwise would have --save-dev there.

screenshot 2016-11-28 15 08 56

@andrew-cunliffe
Copy link

andrew-cunliffe commented Nov 28, 2016

So, I just tried our code without this dependency and migrations don't work now.... last I looked AWS Elastic Beanstalk will only install non dev dependencies, but it has been a while since I tried to check this....

Running "shell:migrateUp" (shell) task
Migrating blog service up in test mode
{ [String: '']
  stdout: '',
  stderr: '/bin/sh: ./node_modules/.bin/sequelize: No such file or directory\n',
  code: 127,
  cat: [Function: bound ],
  head: [Function: bound ],
  tail: [Function: bound ],
  to: [Function: bound ],
  toEnd: [Function: bound ],
  sed: [Function: bound ],
  sort: [Function: bound ],
  uniq: [Function: bound ],
  grep: [Function: bound ],
  exec: [Function: bound ] }
Warning: Done, with errors: command "./scripts/migrations.js migrate" (target "migrateUp") exited with code 1. Use --force to continue.

What is the recommended way to run migrations on deployment if this is a dev dependency?

While I understand it might not be part of the running production code we need to execute the dependency on the production servers to run the migrations, this means we need to be happy it has no vulnerabilities....?

Open to your thoughts / ideas on this

Some insights to the script if it helps

program
    .command('migrate [services...]')
    .description('run migrations for a service')
    .option('-d, --direction [direction]', 'Which direction to go up / down', 'up')
    .action((services, options) => {
        
        // removed snippet

        services.forEach(item => {
            let path = `scripts/migrations.tmp/${item}`;
            console.log(`Migrating ${item} service ${options.direction} in ${program.env} mode`);
            shell.mkdir('-p', path);

            // removed snippet

            var shellExec = shell.exec(`./node_modules/.bin/sequelize ${migrateCmd} \
                --env=${program.env} \
                --config=src/common/db.config.js \
                --migrations-path=${path}`,
                { silent: true }
            );

            // removed snippet

        });
    });

@felixfbecker
Copy link
Author

My understanding that devDependencies are everything needed to build and test your code. For example also Babel or TypeScript. In your production env you of course also need to install those to build your project, so I would never use --production flag.

@sonicoder86
Copy link

Created pull request that fixes it #430

@sonicoder86
Copy link

@felixfbecker Isn't it used only for testing? I don't see any sign of it in the bin file.

@sushantdhiman sushantdhiman added this to the v4.0.0 milestone Mar 25, 2017
@idris
Copy link

idris commented Jun 15, 2017

Would an upgrade to Gulp 4 fix this issue? Especially in the 2.x.x version of sequelize-cli

/cc @sushantdhiman

@webmobiles
Copy link

why use one thing old like Gulp, is not better webpack ? why sequelize tool don't generate ES6 js ? i am newbie with sequelize, but i don't understand why to write code like 5 years ago

@sushantdhiman
Copy link
Contributor

Because this project is around 7 years old, be patient we are working on fixing things. If you want things to accelerate send me a PR :)

@webmobiles
Copy link

oh my God,; 7 years old :-) , must too look another ES6/ES7 Orm

@sushantdhiman
Copy link
Contributor

@webmobiles I suggest https://github.com/Vincit/objection.js/ , you are welcome to try Sequelize any time :). Its open source after all

@webmobiles
Copy link

thanks susan , it was a joke, i am a dinosaur that comes from old php 4, in the new node world, i feel like i'm not working with modern tools so that gets me crazy, thanks , hope to learn to contribute to modernize all these old packages

@sushantdhiman sushantdhiman mentioned this issue Sep 1, 2017
@sushantdhiman
Copy link
Contributor

480f3fc

codetriage-readme-bot pushed a commit to codetriage-readme-bot/cli that referenced this issue Jun 5, 2019
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

No branches or pull requests

10 participants