Skip to content

potential security vulnerability via an outdated version of static-module@1.5.0 > static-eval@0.2.4 #19

Open

Description

Hi,
this is perhaps not the place to report it, please feel free to close the issue, but the version of static-module specified in the package.json is affected by this security vulnerability:
https://nodesecurity.io/advisories/548
cwise@1.0.10 > static-module@1.5.0 > static-eval@0.2.4

I have tried to update static-module to version ^2.0.0 which fixes the issue:
browserify/static-module#34

...but the tests are failing. I do no know this code enough to fix it, any help is welcome.

This is part of making plotly.js pass security tests:
plotly/plotly.js#2386

Would also be good to have a security badge with:
snyk: https://github.com/snyk/snyk#badge
or
nsp: see https://github.com/dwyl/repo-badges
Thx
Alex

Activity

  1. etpinard commented on Feb 21, 2018

    @etpinard
    Contributor

    Unfortunately, bumping static-module to the unvulnerable 2.x series won't be trivial.

    Changes from PRs browserify/static-eval#18 and browserify/static-module#38 appear to be incompatible with cwise.

    From my findings, static-module fails (i.e. does not transform cwise({args: [], body: () => {}}) expressions) whenever body() mutates one if its input arguments.

    For example, with

    // cmd.js
    var fs = require('fs')
    var sm = require('./lib/cwise-transform')()
    
    process.stdin.pipe(sm).pipe(process.stdout)
    // works.js
    var cwise = require('cwise')
    var f = cwise({
      args: ["array"],
      body: function() {
          return 'yo'
      },
    })
    // fails.js
    var cwise = require('cwise')
    var f = cwise({
      args: ["array"],
      body: function(a) {
          ++a
      },
    })

    then, node cmd.js < works.js works just fine (but doesn't do anything 😏 ), and node cmd.js < fails.js outputs:

    
    var f = cwise({
      args: ["array"],
      body: function(a) {
          ++a
      }
    })
    

    that is, it correctly removes the require statement, but ignores the cwise call.

  2. michal-rad commented on Feb 27, 2018

    @michal-rad

    +1

  3. etpinard commented on Mar 5, 2018

    @etpinard
    Contributor

    @alhugot I believe your patch in https://github.com/alhugot/cwise/commit/39b4ad8a1c67d94903bdc139e59bc764e59bad6f defeats the purpose of browserify suite where cwise is used as a transform.

    To double-check, would you mind comparing the output of browserify -t cwise test/fill.js using old and new static-module versions?

  4. etpinard commented on Mar 5, 2018

    @etpinard
    Contributor

    . Sorry a bit slow on this one.

    No worries. Thanks for the help!

  5. dutscher commented on Mar 9, 2018

    @dutscher

    +1

  6. hakandilek commented on May 30, 2018

    @hakandilek

    @etpinard browserify -t cwise test/fill.js outputs are the same with static-module@2.2.5

  7. etpinard commented on May 30, 2018

    @etpinard
    Contributor

    @hakandilek thanks for the headsup, but npm test fails for me with static-module@2.2.5.

  8. hakandilek commented on May 30, 2018

    @hakandilek
  9. etpinard commented on May 30, 2018

    @etpinard
    Contributor

    Check out my linked pull request.

    Ha. Sorry I missed that. Thanks for the PR.

  10. srinivasrk commented on Jun 22, 2018

    @srinivasrk

    any update on this issue ?

  11. elf-mouse commented on Feb 28, 2019

    @elf-mouse

    potential security vulnerability +1

  12. k-sai-kiranmayee commented on Sep 25, 2019

    @k-sai-kiranmayee

    Hello! Is there any update on this one...Is this #21 successfully merged?

    Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions