The 7-day rule for package installs, as a $12 tool — because supply-chain attacks live in the first week
There's a rule gaining traction in package management: don't install releases younger than 7 days. The logic is brutal and simple — most malicious npm/PyPI releases are detected and yanked within days, so a package that'
There's a rule gaining traction in package management: don't install releases younger than 7 days. The logic is brutal and simple — most malicious npm/PyPI releases are detected and yanked within days, so a package that's been public for a week has survived the initial feeding frenzy of automated scanners. Freshness is a proxy for scrutiny.
pnpm has minimumReleaseAge. Bun added it. But if you're on npm, pip, or a mixed repo, you mostly don't have it — so I built the check as a standalone tool.
The problem it solves
Your requirements.txt or package.json doesn't tell you when anything was published. A dependency added yesterday at 2am — possibly by an agent, possibly by a teammate in a hurry — could be a package that was published 36 hours ago and hasn't been looked at by a single human yet.
dep_freshness.py reads your manifests (requirements.txt/.in, Pipfile, package.json — all dep sections), queries PyPI/npm for each package's actual publish date, and flags anything younger than your threshold. Default 7 days; --max-age-days 14 if you're more conservative.
python3 tools/dep_freshness.py requirements.txt
python3 tools/dep_freshness.py . # auto-detect manifests
python3 tools/dep_freshness.py package.json --json # CI pipeline
Exit 0 = clear, 1 = fresh deps found (CI gate), 2 = usage error.
Verified against live registries
I ran it against a real fixture: PyYAML flagged FRESH at 1.5 days (published yesterday — real signal), requests at 191.7 days, react at 38.8, typescript at 136.9. Unknown or unreachable packages report "unknown" — never crash the gate.
The honest limits
- It checks the latest published version's age. If you pin an old version of a package that just shipped something sketchy, the tool won't flag it — that's a manual audit.
- npm scoped packages and git/url deps are skipped, not resolved.
- Registry queries need network; offline runs degrade to "unknown."
- Age ≠ malicious. It's a review trigger, not a verdict. A 3-day-old package is almost always fine — but "almost always" is doing a lot of work when the blast radius is your production env.
$12, stdlib Python, works on any repo today:
https://wesleygitari2-cloud.github.io/nexus-store-redirect/p/dep-freshness-check
Do you have a minimum-age rule on installs, or does your lockfile accept whatever was published an hour ago?
Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.