[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Security concerns with minified javascript code



 ❦ 28 août 2015 01:46 GMT, Bas Wijnen <wijnen@debian.org> :

> Or alternatively, by packaging the minifier that is being used with the package
> that needs it.  Yes, that's a horrible idea with lots of code duplication, but
> if I understand the problem, every JS file must be minified with the exact
> version of the minifier that upstream used, so then every package would have
> its own unique package that it depends on, and in that case they can just be
> merged.  But it can't really be that bad, right?

Here is the dependency graph of jQuery (only to build it!):

jquery@3.0.0-pre /home/bernat/src/jquery
├─┬ commitplease@2.0.0
│ ├─┬ chalk@0.4.0
│ │ ├── ansi-styles@1.0.0
│ │ ├── has-color@0.1.7
│ │ └── strip-ansi@0.1.1
│ ├── mout@0.8.0
│ └── semver@2.2.1
├── core-js@0.9.17
├─┬ grunt@0.4.5
│ ├── async@0.1.22
│ ├── coffee-script@1.3.3
│ ├── colors@0.6.2
│ ├── dateformat@1.0.2-1.2.3
│ ├── eventemitter2@0.4.14
│ ├── exit@0.1.2
│ ├─┬ findup-sync@0.1.3
│ │ ├─┬ glob@3.2.11
│ │ │ ├── inherits@2.0.1
│ │ │ └─┬ minimatch@0.3.0
│ │ │   ├── lru-cache@2.6.5
│ │ │   └── sigmund@1.0.1
│ │ └── lodash@2.4.2
│ ├── getobject@0.1.0
│ ├─┬ glob@3.1.21
│ │ ├── graceful-fs@1.2.3
│ │ └── inherits@1.0.2
│ ├─┬ grunt-legacy-log@0.1.2
│ │ ├── grunt-legacy-log-utils@0.1.1
│ │ ├── lodash@2.4.2
│ │ └── underscore.string@2.3.3
│ ├── grunt-legacy-util@0.2.0
│ ├── hooker@0.2.3
│ ├── iconv-lite@0.2.11
│ ├─┬ js-yaml@2.0.5
│ │ ├─┬ argparse@0.1.16
│ │ │ ├── underscore@1.7.0
│ │ │ └── underscore.string@2.4.0
│ │ └── esprima@1.0.4
│ ├── lodash@0.9.2
│ ├─┬ minimatch@0.2.14
│ │ ├── lru-cache@2.6.5
│ │ └── sigmund@1.0.1
│ ├─┬ nopt@1.0.10
│ │ └── abbrev@1.0.7
│ ├── rimraf@2.2.8
│ ├── underscore.string@2.2.1
│ └── which@1.0.9
├─┬ grunt-babel@5.0.1
│ └─┬ babel-core@5.8.23
│   ├── babel-plugin-constant-folding@1.0.1
│   ├── babel-plugin-dead-code-elimination@1.0.2
│   ├── babel-plugin-eval@1.0.1
│   ├── babel-plugin-inline-environment-variables@1.0.1
│   ├── babel-plugin-jscript@1.0.4
│   ├── babel-plugin-member-expression-literals@1.0.1
│   ├── babel-plugin-property-literals@1.0.1
│   ├── babel-plugin-proto-to-assign@1.0.4
│   ├── babel-plugin-react-constant-elements@1.0.3
│   ├── babel-plugin-react-display-name@1.0.3
│   ├── babel-plugin-remove-console@1.0.1
│   ├── babel-plugin-remove-debugger@1.0.1
│   ├── babel-plugin-runtime@1.0.7
│   ├─┬ babel-plugin-undeclared-variables-check@1.0.2
│   │ └── leven@1.0.2
│   ├── babel-plugin-undefined-to-void@1.1.6
│   ├── babylon@5.8.23
│   ├── bluebird@2.9.34
│   ├─┬ chalk@1.1.1
│   │ ├── ansi-styles@2.1.0
│   │ ├── escape-string-regexp@1.0.3
│   │ ├─┬ has-ansi@2.0.0
│   │ │ └── ansi-regex@2.0.0
│   │ ├─┬ strip-ansi@3.0.0
│   │ │ └── ansi-regex@2.0.0
│   │ └── supports-color@2.0.0
│   ├── convert-source-map@1.1.1
│   ├── core-js@1.1.1
│   ├─┬ debug@2.2.0
│   │ └── ms@0.7.1
│   ├─┬ detect-indent@3.0.1
│   │ ├── get-stdin@4.0.1
│   │ └── minimist@1.2.0
│   ├── esutils@2.0.2
│   ├── fs-readdir-recursive@0.1.2
│   ├── globals@6.4.1
│   ├─┬ home-or-tmp@1.0.0
│   │ ├── os-tmpdir@1.0.1
│   │ └── user-home@1.1.1
│   ├─┬ is-integer@1.0.4
│   │ ├─┬ is-finite@1.0.1
│   │ │ └── number-is-nan@1.0.0
│   │ └─┬ is-nan@1.2.1
│   │   └─┬ define-properties@1.1.1
│   │     ├── foreach@2.0.5
│   │     └── object-keys@1.0.7
│   ├── js-tokens@1.0.1
│   ├── json5@0.4.0
│   ├─┬ line-numbers@0.2.0
│   │ └── left-pad@0.0.3
│   ├── lodash@3.10.1
│   ├─┬ minimatch@2.0.10
│   │ └─┬ brace-expansion@1.1.0
│   │   ├── balanced-match@0.2.0
│   │   └── concat-map@0.0.1
│   ├─┬ output-file-sync@1.1.1
│   │ ├─┬ mkdirp@0.5.1
│   │ │ └── minimist@0.0.8
│   │ └── xtend@4.0.0
│   ├── path-exists@1.0.0
│   ├── path-is-absolute@1.0.0
│   ├── private@0.1.6
│   ├─┬ regenerator@0.8.35
│   │ ├─┬ commoner@0.10.3
│   │ │ ├── commander@2.5.1
│   │ │ ├─┬ glob@4.2.2
│   │ │ │ ├─┬ inflight@1.0.4
│   │ │ │ │ └── wrappy@1.0.1
│   │ │ │ ├── inherits@2.0.1
│   │ │ │ ├─┬ minimatch@1.0.0
│   │ │ │ │ ├── lru-cache@2.6.5
│   │ │ │ │ └── sigmund@1.0.1
│   │ │ │ └─┬ once@1.3.2
│   │ │ │   └── wrappy@1.0.1
│   │ │ ├── graceful-fs@3.0.8
│   │ │ ├── iconv-lite@0.4.11
│   │ │ ├── install@0.1.8
│   │ │ └─┬ mkdirp@0.5.1
│   │ │   └── minimist@0.0.8
│   │ ├─┬ defs@1.1.0
│   │ │ ├─┬ alter@0.2.0
│   │ │ │ └── stable@0.1.5
│   │ │ ├── ast-traverse@0.1.1
│   │ │ ├── breakable@1.0.0
│   │ │ ├── esprima-fb@8001.1001.0-dev-harmony-fb
│   │ │ ├── simple-fmt@0.1.0
│   │ │ ├── simple-is@0.2.0
│   │ │ ├── stringmap@0.2.2
│   │ │ ├── stringset@0.2.1
│   │ │ ├── tryor@0.1.2
│   │ │ └── yargs@1.3.3
│   │ ├── esprima-fb@15001.1.0-dev-harmony-fb
│   │ ├─┬ recast@0.10.24
│   │ │ └── ast-types@0.8.5
│   │ └── through@2.3.8
│   ├─┬ regexpu@1.2.0
│   │ ├─┬ recast@0.10.32
│   │ │ ├── ast-types@0.8.11
│   │ │ └── esprima-fb@15001.1001.0-dev-harmony-fb
│   │ ├── regenerate@1.2.1
│   │ ├── regjsgen@0.2.0
│   │ └─┬ regjsparser@0.1.5
│   │   └── jsesc@0.5.0
│   ├─┬ repeating@1.1.3
│   │ └─┬ is-finite@1.0.1
│   │   └── number-is-nan@1.0.0
│   ├── resolve@1.1.6
│   ├── shebang-regex@1.0.0
│   ├── slash@1.0.0
│   ├─┬ source-map@0.4.4
│   │ └── amdefine@1.0.0
│   ├─┬ source-map-support@0.2.10
│   │ └─┬ source-map@0.1.32
│   │   └── amdefine@1.0.0
│   ├── to-fast-properties@1.0.1
│   ├── trim-right@1.0.1
│   └── try-resolve@1.0.1
├─┬ grunt-cli@0.1.13
│ ├─┬ findup-sync@0.1.3
│ │ ├─┬ glob@3.2.11
│ │ │ ├── inherits@2.0.1
│ │ │ └─┬ minimatch@0.3.0
│ │ │   ├── lru-cache@2.6.5
│ │ │   └── sigmund@1.0.1
│ │ └── lodash@2.4.2
│ ├─┬ nopt@1.0.10
│ │ └── abbrev@1.0.7
│ └── resolve@0.3.1
├── grunt-compare-size@0.4.0
├─┬ grunt-contrib-jshint@0.11.2
│ ├── hooker@0.2.3
│ └─┬ jshint@2.8.0
│   ├─┬ cli@0.6.6
│   │ └─┬ glob@3.2.11
│   │   ├── inherits@2.0.1
│   │   └─┬ minimatch@0.3.0
│   │     ├── lru-cache@2.6.5
│   │     └── sigmund@1.0.1
│   ├─┬ console-browserify@1.1.0
│   │ └── date-now@0.1.4
│   ├── exit@0.1.2
│   ├─┬ htmlparser2@3.8.3
│   │ ├── domelementtype@1.3.0
│   │ ├── domhandler@2.3.0
│   │ ├─┬ domutils@1.5.1
│   │ │ └─┬ dom-serializer@0.1.0
│   │ │   ├── domelementtype@1.1.3
│   │ │   └── entities@1.1.1
│   │ ├── entities@1.0.0
│   │ └─┬ readable-stream@1.1.13
│   │   ├── core-util-is@1.0.1
│   │   ├── inherits@2.0.1
│   │   ├── isarray@0.0.1
│   │   └── string_decoder@0.10.31
│   ├── lodash@3.7.0
│   ├─┬ minimatch@2.0.10
│   │ └─┬ brace-expansion@1.1.0
│   │   ├── balanced-match@0.2.0
│   │   └── concat-map@0.0.1
│   └── shelljs@0.3.0
├─┬ grunt-contrib-uglify@0.7.0
│ ├─┬ chalk@0.5.1
│ │ ├── ansi-styles@1.1.0
│ │ ├── escape-string-regexp@1.0.3
│ │ ├─┬ has-ansi@0.1.0
│ │ │ └── ansi-regex@0.2.1
│ │ ├─┬ strip-ansi@0.3.0
│ │ │ └── ansi-regex@0.2.1
│ │ └── supports-color@0.2.0
│ ├── lodash@2.4.2
│ ├─┬ maxmin@1.1.0
│ │ ├─┬ chalk@1.1.1
│ │ │ ├── ansi-styles@2.1.0
│ │ │ ├── escape-string-regexp@1.0.3
│ │ │ ├─┬ has-ansi@2.0.0
│ │ │ │ └── ansi-regex@2.0.0
│ │ │ ├─┬ strip-ansi@3.0.0
│ │ │ │ └── ansi-regex@2.0.0
│ │ │ └── supports-color@2.0.0
│ │ ├── figures@1.3.5
│ │ ├─┬ gzip-size@1.0.0
│ │ │ ├─┬ browserify-zlib@0.1.4
│ │ │ │ └── pako@0.2.7
│ │ │ └─┬ concat-stream@1.5.0
│ │ │   ├── inherits@2.0.1
│ │ │   ├─┬ readable-stream@2.0.2
│ │ │   │ ├── core-util-is@1.0.1
│ │ │   │ ├── isarray@0.0.1
│ │ │   │ ├── process-nextick-args@1.0.2
│ │ │   │ ├── string_decoder@0.10.31
│ │ │   │ └── util-deprecate@1.0.1
│ │ │   └── typedarray@0.0.6
│ │ └─┬ pretty-bytes@1.0.4
│ │   ├── get-stdin@4.0.1
│ │   └─┬ meow@3.3.0
│ │     ├─┬ camelcase-keys@1.0.0
│ │     │ ├── camelcase@1.2.1
│ │     │ └── map-obj@1.0.1
│ │     ├─┬ indent-string@1.2.2
│ │     │ └─┬ repeating@1.1.3
│ │     │   └─┬ is-finite@1.0.1
│ │     │     └── number-is-nan@1.0.0
│ │     ├── minimist@1.2.0
│ │     └── object-assign@3.0.0
│ ├─┬ uglify-js@2.4.24
│ │ ├── async@0.2.10
│ │ ├─┬ source-map@0.1.34
│ │ │ └── amdefine@1.0.0
│ │ ├── uglify-to-browserify@1.0.2
│ │ └─┬ yargs@3.5.4
│ │   ├── camelcase@1.2.1
│ │   ├── decamelize@1.0.0
│ │   ├── window-size@0.1.0
│ │   └── wordwrap@0.0.2
│ └── uri-path@0.0.2
├─┬ grunt-contrib-watch@0.6.1
│ ├── async@0.2.10
│ ├─┬ gaze@0.5.1
│ │ └─┬ globule@0.1.0
│ │   ├─┬ glob@3.1.21
│ │   │ ├── graceful-fs@1.2.3
│ │   │ └── inherits@1.0.2
│ │   ├── lodash@1.0.2
│ │   └─┬ minimatch@0.2.14
│ │     ├── lru-cache@2.6.5
│ │     └── sigmund@1.0.1
│ ├── lodash@2.4.2
│ └─┬ tiny-lr-fork@0.0.5
│   ├── debug@0.7.4
│   ├── faye-websocket@0.4.4
│   ├─┬ noptify@0.0.3
│   │ └─┬ nopt@2.0.0
│   │   └── abbrev@1.0.7
│   └── qs@0.5.6
├─┬ grunt-git-authors@2.0.1
│ └── spawnback@1.0.0
├─┬ grunt-jscs-checker@0.8.1
│ ├── hooker@0.2.3
│ ├─┬ jscs@1.7.3
│ │ ├── colors@0.6.2
│ │ ├── commander@2.3.0
│ │ ├── esprima@1.2.5
│ │ ├── esprima-harmony-jscs@1.1.0-dev-harmony
│ │ ├── exit@0.1.2
│ │ ├─┬ glob@4.0.6
│ │ │ ├── graceful-fs@3.0.8
│ │ │ ├── inherits@2.0.1
│ │ │ └─┬ once@1.3.2
│ │ │   └── wrappy@1.0.1
│ │ ├─┬ minimatch@1.0.0
│ │ │ ├── lru-cache@2.6.5
│ │ │ └── sigmund@1.0.1
│ │ ├── supports-color@1.1.0
│ │ ├─┬ vow-fs@0.3.4
│ │ │ ├─┬ glob@4.5.3
│ │ │ │ ├─┬ inflight@1.0.4
│ │ │ │ │ └── wrappy@1.0.1
│ │ │ │ ├── inherits@2.0.1
│ │ │ │ ├─┬ minimatch@2.0.10
│ │ │ │ │ └─┬ brace-expansion@1.1.0
│ │ │ │ │   ├── balanced-match@0.2.0
│ │ │ │ │   └── concat-map@0.0.1
│ │ │ │ └─┬ once@1.3.2
│ │ │ │   └── wrappy@1.0.1
│ │ │ ├── node-uuid@1.4.3
│ │ │ └── vow-queue@0.4.2
│ │ └─┬ xmlbuilder@2.4.6
│ │   └── lodash-node@2.4.1
│ ├── lodash@2.4.2
│ └── vow@0.4.10
├─┬ grunt-jsonlint@1.0.4
│ └─┬ jsonlint@1.6.0
│   ├── JSV@4.0.2
│   └─┬ nomnom@1.8.1
│     ├─┬ chalk@0.4.0
│     │ ├── ansi-styles@1.0.0
│     │ ├── has-color@0.1.7
│     │ └── strip-ansi@0.1.1
│     └── underscore@1.6.0
├─┬ grunt-npmcopy@0.1.0
│ ├─┬ glob@4.5.3
│ │ ├─┬ inflight@1.0.4
│ │ │ └── wrappy@1.0.1
│ │ ├── inherits@2.0.1
│ │ ├─┬ minimatch@2.0.10
│ │ │ └─┬ brace-expansion@1.1.0
│ │ │   ├── balanced-match@0.2.0
│ │ │   └── concat-map@0.0.1
│ │ └─┬ once@1.3.2
│ │   └── wrappy@1.0.1
│ └── lodash@2.4.2
├─┬ gzip-js@0.3.2
│ ├── crc32@0.2.2
│ └── deflate-js@0.2.3
├─┬ jsdom@3.1.2 extraneous
│ ├── acorn@0.11.0
│ ├─┬ acorn-globals@1.0.5
│ │ └── acorn@2.3.0
│ ├── browser-request@0.3.3
│ ├─┬ contextify@0.1.14
│ │ ├── bindings@1.2.1
│ │ └── nan@1.8.4
│ ├── cssom@0.3.0
│ ├── cssstyle@0.2.29
│ ├─┬ escodegen@1.6.1
│ │ ├── esprima@1.2.5
│ │ ├── estraverse@1.9.3
│ │ ├── esutils@1.1.6
│ │ ├─┬ optionator@0.5.0
│ │ │ ├── deep-is@0.1.3
│ │ │ ├── fast-levenshtein@1.0.7
│ │ │ ├── levn@0.2.5
│ │ │ ├── prelude-ls@1.1.2
│ │ │ ├── type-check@0.3.1
│ │ │ └── wordwrap@0.0.3
│ │ └─┬ source-map@0.1.43
│ │   └── amdefine@1.0.0
│ ├─┬ htmlparser2@3.8.3
│ │ ├── domelementtype@1.3.0
│ │ ├── domhandler@2.3.0
│ │ ├─┬ domutils@1.5.1
│ │ │ └─┬ dom-serializer@0.1.0
│ │ │   ├── domelementtype@1.1.3
│ │ │   └── entities@1.1.1
│ │ ├── entities@1.0.0
│ │ └─┬ readable-stream@1.1.13
│ │   ├── core-util-is@1.0.1
│ │   ├── inherits@2.0.1
│ │   ├── isarray@0.0.1
│ │   └── string_decoder@0.10.31
│ ├── nwmatcher@1.3.6
│ ├── parse5@1.5.0
│ ├─┬ request@2.61.0
│ │ ├── aws-sign2@0.5.0
│ │ ├─┬ bl@1.0.0
│ │ │ └─┬ readable-stream@2.0.2
│ │ │   ├── core-util-is@1.0.1
│ │ │   ├── inherits@2.0.1
│ │ │   ├── isarray@0.0.1
│ │ │   ├── process-nextick-args@1.0.2
│ │ │   ├── string_decoder@0.10.31
│ │ │   └── util-deprecate@1.0.1
│ │ ├── caseless@0.11.0
│ │ ├─┬ combined-stream@1.0.5
│ │ │ └── delayed-stream@1.0.0
│ │ ├── extend@3.0.0
│ │ ├── forever-agent@0.6.1
│ │ ├─┬ form-data@1.0.0-rc3
│ │ │ └── async@1.4.2
│ │ ├─┬ har-validator@1.8.0
│ │ │ ├── bluebird@2.9.34
│ │ │ ├─┬ chalk@1.1.1
│ │ │ │ ├── ansi-styles@2.1.0
│ │ │ │ ├── escape-string-regexp@1.0.3
│ │ │ │ ├─┬ has-ansi@2.0.0
│ │ │ │ │ └── ansi-regex@2.0.0
│ │ │ │ ├─┬ strip-ansi@3.0.0
│ │ │ │ │ └── ansi-regex@2.0.0
│ │ │ │ └── supports-color@2.0.0
│ │ │ ├─┬ commander@2.8.1
│ │ │ │ └── graceful-readlink@1.0.1
│ │ │ └─┬ is-my-json-valid@2.12.1
│ │ │   ├── generate-function@2.0.0
│ │ │   ├─┬ generate-object-property@1.2.0
│ │ │   │ └── is-property@1.0.2
│ │ │   ├── jsonpointer@1.1.0
│ │ │   └── xtend@4.0.0
│ │ ├─┬ hawk@3.1.0
│ │ │ ├── boom@2.8.0
│ │ │ ├── cryptiles@2.0.4
│ │ │ ├── hoek@2.14.0
│ │ │ └── sntp@1.0.9
│ │ ├─┬ http-signature@0.11.0
│ │ │ ├── asn1@0.1.11
│ │ │ ├── assert-plus@0.1.5
│ │ │ └── ctype@0.5.3
│ │ ├── isstream@0.1.2
│ │ ├── json-stringify-safe@5.0.1
│ │ ├─┬ mime-types@2.1.5
│ │ │ └── mime-db@1.17.0
│ │ ├── node-uuid@1.4.3
│ │ ├── oauth-sign@0.8.0
│ │ ├── qs@4.0.0
│ │ ├── stringstream@0.0.4
│ │ ├── tough-cookie@2.0.0
│ │ └── tunnel-agent@0.4.1
│ ├── xml-name-validator@1.0.0
│ └── xmlhttprequest@1.7.0
├─┬ load-grunt-tasks@1.0.0
│ ├─┬ findup-sync@0.1.3
│ │ ├─┬ glob@3.2.11
│ │ │ ├── inherits@2.0.1
│ │ │ └─┬ minimatch@0.3.0
│ │ │   ├── lru-cache@2.6.5
│ │ │   └── sigmund@1.0.1
│ │ └── lodash@2.4.2
│ └─┬ multimatch@1.0.1
│   ├── array-differ@1.0.0
│   ├─┬ array-union@1.0.1
│   │ └── array-uniq@1.0.2
│   └─┬ minimatch@1.0.0
│     ├── lru-cache@2.6.5
│     └── sigmund@1.0.1
├── native-promise-only@0.7.8-a
├─┬ promises-aplus-tests@2.1.0
│ ├─┬ mocha@1.21.5
│ │ ├── commander@2.3.0
│ │ ├─┬ debug@2.0.0
│ │ │ └── ms@0.6.2
│ │ ├── diff@1.0.8
│ │ ├── escape-string-regexp@1.0.2
│ │ ├─┬ glob@3.2.3
│ │ │ ├── graceful-fs@2.0.3
│ │ │ ├── inherits@2.0.1
│ │ │ └─┬ minimatch@0.2.14
│ │ │   ├── lru-cache@2.6.5
│ │ │   └── sigmund@1.0.1
│ │ ├── growl@1.8.1
│ │ ├─┬ jade@0.26.3
│ │ │ ├── commander@0.6.1
│ │ │ └── mkdirp@0.3.0
│ │ └─┬ mkdirp@0.5.0
│ │   └── minimist@0.0.8
│ └── underscore@1.6.0
├── q@1.1.2
├── qunitjs@1.17.1
├── requirejs@2.1.17
├─┬ sinon@1.10.3
│ ├─┬ formatio@1.0.2
│ │ └── samsam@1.1.2
│ └─┬ util@0.10.3
│   └── inherits@2.0.1
├── sizzle@2.2.0
├── strip-json-comments@1.0.3
├─┬ testswarm@1.1.0
│ └─┬ request@2.12.0
│   ├─┬ form-data@0.0.3
│   │ ├── async@0.1.9
│   │ └─┬ combined-stream@0.0.3
│   │   └── delayed-stream@0.0.5
│   └── mime@1.2.7
└── win-spawn@2.0.0
-- 
Use the good features of a language; avoid the bad ones.
            - The Elements of Programming Style (Kernighan & Plauger)

Attachment: signature.asc
Description: PGP signature


Reply to: