logo

drewdevault.com

[mirror] blog and personal website of Drew DeVault git clone https://hacktivis.me/git/mirror/drewdevault.com.git

Cash-for-leftpad.md (4843B)


  1. ---
  2. title: I will pay you cash to delete your npm module
  3. date: 2021-11-16
  4. ---
  5. npm's culture presents a major problem for global software security. It's
  6. grossly irresponsible to let dependency trees grow to thousands of dependencies,
  7. from vendors you may have never heard of and likely have not critically
  8. evaluated, to solve trivial tasks which could have been done from scratch in
  9. mere seconds, or, if properly considered, might not even be needed in the first
  10. place.
  11. We need to figure out a way to curb this reckless behavior, but how?
  12. I have an idea. Remember left-pad? That needs to happen more often.
  13. ![A LaTeX rendering of an equation which sets a reward (in dollars) to the logarithm of weekly downloads over lines of code in base 10 times one hundred](https://l.sr.ht/Fe7o.svg)
  14. I'll pay you cold hard cash to delete your npm module. The exact amount will be
  15. determined on this equation, which is designed to offer higher payouts for
  16. modules with more downloads and fewer lines of code. A condition of this is that
  17. you must delete it without notice, so that everyone who depends on it wakes up
  18. to a broken build.
  19. Let's consider an example: [isArray][0]. It has only four lines of code:
  20. [0]: https://www.npmjs.com/package/isarray
  21. ```javascript
  22. var toString = {}.toString;
  23. module.exports = Array.isArray || function (arr) {
  24. return toString.call(arr) === '[object Array]';
  25. };
  26. ```
  27. With 51 million downloads this week, this works out to a reward of $710.
  28. To prevent abuse, we'll have to agree to each case in advance. I'll review your
  29. module to make sure it qualifies, and check for any funny business like
  30. suspicious download figures or minified code. We must come to an agreement
  31. *before* you delete the module, since I will not be able to check the line
  32. counts or download numbers after it's gone.
  33. I may also ask you to wait to delete your module, so that the chaos from each
  34. deletion is separated by a few weeks to maximize the impact. Also, the reward is
  35. capped at $1,000, so that I can still pay rent after this.
  36. Do we have a deal? [Click here to apply →](#conclusion)
  37. <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br />
  38. <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br />
  39. <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br />
  40. <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br />
  41. <a id="conclusion"></a>
  42. Alright, the gig is up: this is satire. I'm not actually going to pay you to
  43. delete your npm module, nor do I want to bring about a dark winter of chaos in
  44. the Node ecosystem. Plus, [it wouldn't actually work][node response].
  45. [node response]: https://blog.npmjs.org/post/141905368000/changes-to-npms-unpublish-policy
  46. I do hope that this idea strikes fear in the hearts of any Node developers that
  47. read it, and in other programming language communities which have taken after
  48. npm. What are you going to do if one of your dependencies vanishes? What if
  49. someone studies the minified code on your website, picks out an obscure
  50. dependency they find there, then bribes the maintainers?
  51. Most Node developers have no idea what's in their dependency tree. Most of them
  52. are thousands of entries long, and have never been audited. This behavior is
  53. totally reckless and needs to stop.
  54. Most of my projects have fewer than 100 dependencies, and many have fewer than
  55. 10. Some have zero. This is by design. You can't have a free lunch, I'm afraid.
  56. Adding a dependency is a serious decision which requires consensus within the
  57. team, an audit of the new dependency, an understanding of its health and
  58. long-term prospects, and an ongoing commitment to re-audit them and be prepared
  59. to change course as necessary.
  60. ---
  61. isArray license:
  62. ```
  63. Copyright (c) 2013 Julian Gruber <julian@juliangruber.com>.
  64. Permission is hereby granted, free of charge, to any person obtaining a copy
  65. of this software and associated documentation files (the "Software"), to deal
  66. in the Software without restriction, including without limitation the rights
  67. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  68. copies of the Software, and to permit persons to whom the Software is
  69. furnished to do so, subject to the following conditions:
  70. The above copyright notice and this permission notice shall be included in all
  71. copies or substantial portions of the Software.
  72. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  73. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  74. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  75. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  76. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  77. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  78. SOFTWARE.
  79. ```