bun-audit
Audit Bun dependencies for vulnerabilities
TLDR
Audit all dependencies in a project with a bun.lock file
Show only vulnerabilities at or above a specific severity level
Audit only production dependencies
Ignore a specific CVE ID
Output the raw JSON report
SYNOPSIS
bun audit [--json] [--ignore <range>...] [--fix]
PARAMETERS
--json
Output results in JSON format for scripting and CI integration.
--ignore <range>
Ignore vulnerabilities matching the specified semver range ( repeatable ).
--fix
Automatically apply fixes by updating vulnerable dependencies and lockfile.
DESCRIPTION
bun audit scans your Bun project's dependencies for known security vulnerabilities.
It analyzes the bun.lockb lockfile and package.json to identify outdated or vulnerable packages using a comprehensive database of Common Vulnerabilities and Exposures (CVEs).
Similar to npm audit or yarn audit, it reports high, medium, and low severity issues with details like affected paths, severity, and suggested fixes.
The command is exceptionally fast due to Bun's optimized JavaScript runtime and bundling capabilities, often completing in milliseconds for large projects.
With --fix, it automatically updates vulnerable dependencies to patched versions, modifying package.json and regenerating the lockfile.
Output includes vulnerability summaries, and --json enables machine-readable JSON format for CI/CD integration.
Ideal for securing JavaScript/TypeScript projects managed by Bun, ensuring safe dependency usage in production environments.
CAVEATS
Requires Bun installation and a bun.lockb file; fixes may introduce breaking changes; uses npm-compatible vulnerability database which may lag on new advisories.
EXIT CODES
0: No vulnerabilities.
1: Vulnerabilities found.
EXAMPLES
bun audit # Basic scan
bun audit --json # JSON output
bun audit --fix # Auto-fix
HISTORY
Introduced in Bun v0.5.0 (September 2022) as part of Bun's all-in-one toolkit by Jarred Sumner. Evolved with Bun's rapid releases, adding --fix in v1.0+ for automated remediation, aligning with modern package manager standards.


