Don’t Let the Package Ruin the Party: Securing Dependencies While Vibe Coding
Vibe coding feels great—until an innocent-looking npm install invites a supply chain attack into your app. This blog breaks down how to safely manage third-party dependencies, even when you’re in the creative zone.

🎯 Introduction: One Install Away from Vulnerability
There’s nothing like rapid prototyping or flow-state coding—where you're installing packages left and right to test an idea quickly.
But here’s the problem: every time you install a dependency, you’re trusting someone else’s code to run in your app—and potentially in your users' environments. That’s why dependency hygiene is essential, even when you're coding at full speed.
⚠️ 1. Think Before You Install
It’s tempting to install a package just because it solves your problem in one line. But some things to check first:
- Is the package actively maintained?
- Does it have recent commits and releases?
- How many weekly downloads does it have?
- Any open security advisories?
You can use:
npm audit
or
bun audit
to check for known vulnerabilities.
🐍 2. Beware of Typosquatting
Attackers often upload malicious packages with names that are very close to popular libraries, like:
react-routerd
instead ofreact-router-dom
expresss
instead ofexpress
Double-check the package name before you install it. One misplaced character can infect your entire app.
🧱 3. Avoid Overstacking the Stack
Installing 10 tiny libraries for trivial things can bloat your app and increase attack surface.
Examples:
- Using
lodash.get
is fine. Using the entirelodash
for one_.get
isn’t. - For basic slugification, consider writing your own small function instead of pulling in a full package.
Rule of thumb: If it's under 10 lines, maybe don't install a package.
🔐 4. Lock Dependencies, Especially in Production
When you’re deploying, always:
- Use lockfiles (
package-lock.json
,bun.lockb
, oryarn.lock
) - Avoid
latest
tags in production - Pin versions during CI builds
This ensures you're deploying exactly what you tested—no surprises.
⚙️ 5. Automate Dependency Audits
Make audits part of your workflow:
- GitHub Dependabot can open PRs for outdated or vulnerable packages.
- Snyk, Socket.dev, or npm audit can scan your codebase regularly.
You can even run audits in your CI/CD pipeline:
npm audit --production
📦 Bonus: Understand What You’re Importing
Many devs use large libraries for small tasks without realizing the baggage:
Bad: pulling the whole moment.js for one format import moment from 'moment' // Better: import { format } from 'date-fns'
Some libraries let you tree-shake, others don’t. Know what’s coming into your bundle.
🧩 Conclusion: Creativity Is Cool, But So Is Caution
When you're deep in the zone, it’s easy to say “I’ll clean it up later.” But messy dependencies are harder to clean up than you think—and one bad package can break or exploit your entire project.
So next time you vibe code and run bun add
or npm install
, do it with your developer brain and security hat on.