惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

F
Full Disclosure
WordPress大学
WordPress大学
小众软件
小众软件
Cloudbric
Cloudbric
AWS News Blog
AWS News Blog
腾讯CDC
量子位
人人都是产品经理
人人都是产品经理
大猫的无限游戏
大猫的无限游戏
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
V
Vulnerabilities – Threatpost
Scott Helme
Scott Helme
Hugging Face - Blog
Hugging Face - Blog
博客园_首页
C
CXSECURITY Database RSS Feed - CXSecurity.com
The Hacker News
The Hacker News
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
IT之家
IT之家
Jina AI
Jina AI
Attack and Defense Labs
Attack and Defense Labs
S
SegmentFault 最新的问题
Simon Willison's Weblog
Simon Willison's Weblog
The Cloudflare Blog
阮一峰的网络日志
阮一峰的网络日志
T
Tailwind CSS Blog
Last Week in AI
Last Week in AI
博客园 - 【当耐特】
Google Online Security Blog
Google Online Security Blog
美团技术团队
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
V
Visual Studio Blog
罗磊的独立博客
L
LINUX DO - 最新话题
博客园 - Franky
博客园 - 叶小钗
Apple Machine Learning Research
Apple Machine Learning Research
The Last Watchdog
The Last Watchdog
J
Java Code Geeks
AI
AI
C
Cisco Blogs
酷 壳 – CoolShell
酷 壳 – CoolShell
C
Cyber Attacks, Cyber Crime and Cyber Security
Cisco Talos Blog
Cisco Talos Blog
博客园 - 三生石上(FineUI控件)
雷峰网
雷峰网
Help Net Security
Help Net Security
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
云风的 BLOG
云风的 BLOG
I
Intezer
S
Securelist

NodeJS Security & NodeJS Secure Coding's Blog

Hardening Your npm and pnpm Configs in the Age of Shai-Hulud Argument Injection vulnerability in git-blame@1.4.0 Argument Injection vulnerability in `gits@0.1.8` Command Injection vulnerability in `@fab1o/git@1.4.0` Command Injection vulnerability in `git-contributors` via unsanitized CLI arguments Command Injection vulnerability in `git-q@0.0.3` Command injection vulnerability via unsanitized CLI arguments in touxing/fast-git-clone Command Injection vulnerability in `willitmerge@0.2.1` A Directory Traversal Vulnerability I found in Mastra AI Frameworks MCP Server Mastering NPX: A Cheatsheet for npm and Node.js Power Users Mitigate Supply Chain Security with DevContainers and 1Password for Node.js Local Development The Tale of the Vulnerable MCP Database Server Bad Security Defaults in Mastra AI Frameworks Templates SQL Injection and Bypassing "Read-Only" Mode in Xata's MCP Server Security Advisory for qix npm supply-chain compromise affecting debug and billions of weekly download users How to Mitigate SQL Bypass in MCP Servers Enhancing MCP Server Security: A Guide to Using execFile Argument Injection Vulnerability in ggit How to Bypass Access Control in PostgreSQL in Simple PSQL MCP Server for SQL Injection Command Injection Flaws in ggit: Unveiling a Vulnerability Command Injection Vulnerability in Create MCP Server STDIO Tool Exposes System Monitoring Functions GitHub Kanban MCP Server Command Injection Vulnerability Threatens Developer Workflows Critical Command Injection Flaw in iOS Simulator MCP Server Exposes Development Environments Command Injection Vulnerability Discovered in Codehooks MCP Server: A Critical Security Analysis SSRF Shenanigans in safe-axios: Redirects Open the Backdoor SSRF Vulnerability in safe-axios: Unintended Public Address Classification Bypassing SSRF Safeguards in ssrfcheck: A Case of Incomplete Denylists Don't Be Fooled by Multicast, SSRF Bypass in private-ip Node.js Authentication from Lucia to Better Auth Bypassing SSRF Protection in nossrf: When Your Safeguards Become Loopholes Vue CLI Security Fix to Mitigate NPM Binary Planting Node.js API Security Vulnerabilities with Path Traversal in files-bucket-server Will You Accept These GPT 4o Secure Coding Recommendations? Command Injection Vulnerability in interactive-git-checkout npm package An Introduction to SSRF Bypasses and Denylist Failures Disclosing a Command Injection Vulnerability in `git-checkout-tool` Prisma Raw Query Leads to SQL Injection? Yes and No Flawed Git Promises Library on npm Leads to Command Injection Vulnerability Regex Gone Wrong: How parse-duration npm Package Can Crash Your Node.js App How I found an XSS in the Nuxt MDC Library for Markdown Content Holes in the Safety Net: Bypassing SSRF Protection in safe-axios How to Parse URLs from Markdown to HTML Securely? NPM Ignore Scripts Best Practices as Security Mitigation for Malicious Packages Where to find npm vulnerabilities? How to Hunt for IDOR Vulnerabilities To Exploit Security Misconfiguration? How to Avoid JWT Security Mistakes in Node.js Can a Node.js Secure Code Review Find Future Vulnerabilities? The Okta bcrypt Security Incident and The Bun vs Node.js Angle in Secure By Design NodeJS Path Traversal Vulnerability Scanner Do not use secrets in environment variables and here's how to do it better How to use npm audit Raw SQL Queries are Actually Better for Security Than ORMs? Node API Security Is Node.js Secure? URL Regex Validation: what can go wrong? Uncovering a Prototype Pollution Regression in the core Node.js project Deno CLI Vulnerability Repeats npm mistakes: CVE-2024-37150 Security skills for JavaScript developers Understanding and Preventing Prototype Pollution in Node.js How to protect against a security breach in React Server Components IDOR Vulnerability: What is it and how to prevent it? The security vulnerability of serving images via a route as opposed to static middleware in Node.js Why is it considered a bad practice to write raw SQL commands? JS Security Concepts for JavaScript Developers Secure Coding Practices in Node.js Against Path Traversal Vulnerabilities Secure JavaScript Coding Practices Against Command Injection Vulnerabilities To IDOR or Not to IDOR: Insecure Direct Object Reference in JavaScript Applications Explained npm vulnerabilities: reviewing the security of your dependencies Disclosing code injection vulnerabilities in safe-eval-2 npm package Introducing Node.js Security Permissions Model, Threat Model, and Security Releases Common Node.js Security Issues and How to Mitigate Them How JavaScript developers should embrace npm security The XZ backdoor CVE-2024-3094: a JavaScript perspective Node.js Security Best Practices The Case for Node.js Secure Configuration Protecting Against Common Node.js Vulnerabilities Input Validation Security Best Practices for Node.js A Node.js Vulnerability Scanner to Avoid Security Risks of EOL Runtime Versions JavaScript Security Issues in Node.js Applications OWASP Node.js Authentication, Authorization and Cryptography Practices OWASP Node.js Best Practices Guide Secure JavaScript Coding to Avoid Insecure Direct Object References (IDOR) North Korea malware on npm and Ledger connect-kit crypto heist 10 Best Practices for Secure Code Review of Node.js code Node.js and OWASP Top Ten Command Injection: Don't Let Your App Go 'BOOM' Secure Code Review Tips to Defend Against Vulnerable Node.js Code Destroyed by Dashes: How Two Hyphens Cause Argument Injection Vulnerability in blamer npm Package Securing Your Node.js Apps by Analyzing Real-World Command Injection Examples An Introduction to Command Injection Vulnerabilities in Node.js and JavaScript
How to use yarn audit
2024-09-26 · via NodeJS Security & NodeJS Secure Coding's Blog

The latest v1 major version of Yarn 1.22.22 supports a dependency audit command yarn audit that is similar to npm audit and allows developers who choose to use the Yarn package manager to check for vulnerabilities in their dependencies.

How Yarn pulls vulnerability information

Yarn uses the same vulnerability database as the npmjs registry (which to date has transitioned over to GitHub and its advisory database).

As such, Yarn just mirrors the same API calls that the npm CLI uses to fetch vulnerability information when running with npm audit and that by default in modern npm versions runs automatically after* installing packages.

It’s important to note that Yarn doesn’t maintain its own vulnerability database, nor curates or triages any security vulnerability information, nor do any vulnerabilities about npm packages are reported to Yarn maintainers.

How to use yarn audit

Simply run yarn audit in your project directory to check for vulnerabilities in your dependencies.

If you don’t already have Yarn’s lockfile generated (yarn.lock), Yarn will generate it for you before running the audit. and then present the results of the audit in a table format.

Here’s an example output of yarn audit:

┌───────────────┬──────────────────────────────────────────────────────────────┐

high Command Injection in lodash

├───────────────┼──────────────────────────────────────────────────────────────┤

Package lodash.template

├───────────────┼──────────────────────────────────────────────────────────────┤

Patched in No patch available

├───────────────┼──────────────────────────────────────────────────────────────┤

Dependency of subfont

├───────────────┼──────────────────────────────────────────────────────────────┤

Path subfont > assetgraph > workbox-build > lodash.template

├───────────────┼──────────────────────────────────────────────────────────────┤

More info https://www.npmjs.com/advisories/1096993

└───────────────┴──────────────────────────────────────────────────────────────┘

┌───────────────┬──────────────────────────────────────────────────────────────┐

high kangax html-minifier REDoS vulnerability

├───────────────┼──────────────────────────────────────────────────────────────┤

Package html-minifier

├───────────────┼──────────────────────────────────────────────────────────────┤

Patched in No patch available

├───────────────┼──────────────────────────────────────────────────────────────┤

Dependency of subfont

├───────────────┼──────────────────────────────────────────────────────────────┤

Path subfont > assetgraph > html-minifier

├───────────────┼──────────────────────────────────────────────────────────────┤

More info https://www.npmjs.com/advisories/1097148

└───────────────┴──────────────────────────────────────────────────────────────┘

┌───────────────┬──────────────────────────────────────────────────────────────┐

high path-to-regexp outputs backtracking regular expressions

├───────────────┼──────────────────────────────────────────────────────────────┤

Package path-to-regexp

├───────────────┼──────────────────────────────────────────────────────────────┤

Patched in >=8.0.0

├───────────────┼──────────────────────────────────────────────────────────────┤

Dependency of astro

├───────────────┼──────────────────────────────────────────────────────────────┤

Path astro > path-to-regexp

├───────────────┼──────────────────────────────────────────────────────────────┤

More info https://www.npmjs.com/advisories/1099538

└───────────────┴──────────────────────────────────────────────────────────────┘

┌───────────────┬──────────────────────────────────────────────────────────────┐

high path-to-regexp outputs backtracking regular expressions

├───────────────┼──────────────────────────────────────────────────────────────┤

Package path-to-regexp

├───────────────┼──────────────────────────────────────────────────────────────┤

Patched in >=8.0.0

├───────────────┼──────────────────────────────────────────────────────────────┤

Dependency of astro-compress

├───────────────┼──────────────────────────────────────────────────────────────┤

Path astro-compress > astro > path-to-regexp

├───────────────┼──────────────────────────────────────────────────────────────┤

More info https://www.npmjs.com/advisories/1099538

└───────────────┴──────────────────────────────────────────────────────────────┘

4 vulnerabilities found - Packages audited: 1625

Severity: 4 High

Done in 59.13s.

Note: if you’re using the latest major version of Yarn - Yarn 4, the audit commands exists under the command-line flag as follows: yarn npm audit (yes I know it looks confusing but that’s the actual command).

How to read security vulnerability results from yarn audit output

Yarn and the npm CLI, while using the same underlying advisory database for vulnerabilities, choose to display and print out the results of the audit in different formats.

Yarn’s table format is quite more friendly and easier to read than npm’s formatting which is much more verbose and harder to parse. To compare, here’s the same path-to-regexp vulnerability as reported by npm audit:

path-to-regexp 4.0.0 - 7.2.0

Severity: high

path-to-regexp outputs backtracking regular expressions - https://github.com/advisories/GHSA-9wv6-86v2-598j

fix available via `npm audit fix --force`

Will install @astrojs/tailwind@2.1.3, which is a breaking change

node_modules/path-to-regexp

astro <=0.0.0-xray-20231129021231 || >=0.18.0-collections.1

Depends on vulnerable versions of @astrojs/markdown-remark

Depends on vulnerable versions of path-to-regexp

node_modules/astro

@astro-community/astro-embed-integration >=0.1.0

Depends on vulnerable versions of @astro-community/astro-embed-twitter

Depends on vulnerable versions of @astro-community/astro-embed-vimeo

Depends on vulnerable versions of @astro-community/astro-embed-youtube

Depends on vulnerable versions of astro

Depends on vulnerable versions of astro-auto-import

node_modules/@astro-community/astro-embed-integration

@astro-community/astro-embed-twitter >=0.1.0

Depends on vulnerable versions of astro

node_modules/@astro-community/astro-embed-twitter

@astro-community/astro-embed-vimeo *

Depends on vulnerable versions of astro

node_modules/@astro-community/astro-embed-vimeo

astro-embed >=0.1.0

Depends on vulnerable versions of @astro-community/astro-embed-integration

Depends on vulnerable versions of @astro-community/astro-embed-twitter

Depends on vulnerable versions of @astro-community/astro-embed-vimeo

Depends on vulnerable versions of @astro-community/astro-embed-youtube

Depends on vulnerable versions of astro

node_modules/astro-embed

...

So, Yarn makes it more obvious to understand the top-level direct dependency that introduces the nested package with the vulnerability, and the path to the vulnerable package.

Hint: Yarn also supports JSON output with yarn audit --json if you want to parse the results programmatically, like say in a CI/CD pipeline or some custom tool you’re building.

How to fix vulnerabilities reported by yarn audit

The vulnerabilities reported by yarn audit can be fixed by updating the vulnerable package to a newer version that has the vulnerability patched, based on the versions range that Yarn reports.

Do note though that sometimes there exist no upgrade versions with a fix to the vulnerability (for example in cases where the vulnerability is very new, or the package is no longer well maintained), in which case you might need to look for alternative packages or solutions. Maybe consider applying the patch yourself using the patch-package package on npm.

That said, I highly recommend both using the Snyk CLI (npm install -g snyk) and integrating Snyk into your GitHub or Gitlab repository so that Snyk can monitor for new vulnerabilities in real-time as it learns about them and then automatically create new Pull Requests with upgrade fixes to your dependencies.

The Snyk CLI is also very handy and much more powerful than both yarn audit and npm audit because it was tailored for developer-first security workflows. For example, it will by default filter noise from development dependencies (those in devDependencies that don’t get pushed to production), and it can also test for vulnerabilities in your own code, Docker images, Kubernetes manifests, Terraform configurations, and more.

By using Snyk you also get access to Snyk’s vulnerability database which is much more comprehensive than the npmjs advisory database, and you get access to Snyk’s security research team that curates and triages security vulnerabilities and can provide you with more context and guidance on how to fix vulnerabilities.

Here’s an example snyk test output:

Tested 684 dependencies for known issues, found 10 issues, 25 vulnerable paths.

Issues to fix by upgrading:

Upgrade astro@3.6.5 to astro@4.13.1 to fix

Cross-site Scripting (XSS) [Medium Severity][https://security.snyk.io/vuln/SNYK-JS-ASTRO-7547139] in astro@3.6.5

introduced by astro@3.6.5

Improper Access Control [Medium Severity][https://security.snyk.io/vuln/SNYK-JS-VITE-6531286] in vite@4.4.9

introduced by astro@3.6.5 > vite@4.4.9

Cross-Site Scripting (XSS) [Medium Severity][https://security.snyk.io/vuln/SNYK-JS-VITE-6098386] in vite@4.4.9

introduced by astro@3.6.5 > vite@4.4.9

Uncontrolled resource consumption [High Severity][https://security.snyk.io/vuln/SNYK-JS-BRACES-6838727] in braces@3.0.2

introduced by astro@3.6.5 > chokidar@3.5.3 > braces@3.0.2 and 8 other path(s)

Access Control Bypass [High Severity][https://security.snyk.io/vuln/SNYK-JS-VITE-6182924] in vite@4.4.9

introduced by astro@3.6.5 > vite@4.4.9

Issues with no direct upgrade or patch:

Prototype Pollution [High Severity][https://security.snyk.io/vuln/SNYK-JS-DSET-7116691] in dset@3.1.3

introduced by astro@3.6.5 > @astrojs/telemetry@3.0.4 > dset@3.1.3

This issue was fixed in versions: 3.1.4

Missing Release of Resource after Effective Lifetime [Medium Severity][https://security.snyk.io/vuln/SNYK-JS-INFLIGHT-6095116] in inflight@1.0.6

introduced by @astrojs/vercel@5.2.0 > @vercel/nft@0.23.1 > glob@7.2.3 > inflight@1.0.6 and 1 other path(s)

No upgrade or patch available

Regular Expression Denial of Service (ReDoS) [Medium Severity][https://security.snyk.io/vuln/SNYK-JS-PATHTOREGEXP-7925106] in path-to-regexp@6.2.1

introduced by astro@3.6.5 > path-to-regexp@6.2.1

This issue was fixed in versions: 8.0.0

Uncontrolled Resource Consumption ('Resource Exhaustion') [Medium Severity][https://security.snyk.io/vuln/SNYK-JS-TAR-6476909] in tar@6.2.0

introduced by @astrojs/vercel@5.2.0 > @vercel/nft@0.23.1 > @mapbox/node-pre-gyp@1.0.11 > tar@6.2.0

This issue was fixed in versions: 6.2.1

Conclusion

Whether you use yarn audit, npm audit or snky test, it’s already a good step forward that you are thinking about your application’s security :-)

I curate many security incidents related to npm on my Awesome Node.js Security repository so secure dependency management is critical and you shouldn’t take it lightly. I agree that there’s a lot of noise to filter through and vulnerability fatigue is a problem, but it’s better to be safe than sorry. Also, learn to use the tools that help you focus on the important bits (hint: Snyk!).

Disclaimer - I work at Snyk!