Kokil Thapa - Professional Web Developer in Nepal
Freelancer Web Developer in Nepal with 15+ Years of Experience

Kokil Thapa is an experienced full-stack web developer focused on building fast, secure, and scalable web applications. He helps businesses and individuals create SEO-friendly, user-focused digital platforms designed for long-term growth.

Dependency Vulnerability Scanning Setup

By Kokil Thapa | Last reviewed: August 2026

A proper dependency vulnerability scanning setup is the single most effective control you can add to a PHP or Node.js project today. Most breaches I investigate in Nepal and globally stem not from custom code flaws but from unpatched third-party packages with known CVEs. Whether you maintain a Laravel SaaS platform, a WooCommerce store, or a legal-tech portal, automating this detection prevents shipping compromised code. This guide covers the exact configuration I use across production systems to catch vulnerabilities before they reach your server.

How Do You Configure Native Dependency Vulnerability Scanning Setup for PHP and Node?

Before adding external services or paid SaaS platforms, exhaust the capabilities built directly into your package managers. Modern versions of Composer and npm have significantly improved their native auditing, making them the first line of defense in any Laravel developer's security toolkit. These tools check your installed packages against public vulnerability databases like GitHub Advisory and Packagist without requiring API keys or network calls to proprietary servers.

Composer Audit for PHP Projects

Since Composer 2.4, the audit command has been stable and reliable. On any project running PHP 8.2+ with Composer 2.7+, this should be part of your daily workflow. Unlike older third-party plugins, it respects your composer.lock file exactly, meaning it reports vulnerabilities for the specific versions you have pinned, not just the latest available.

<!-- Run a standard audit -->
composer audit

<!-- Return non-zero exit code on HIGH severity (for CI) -->
composer audit --severity=high

<!-- Output as JSON for parsing in pipelines -->
composer audit --format=json

<!-- Ignore specific advisories with documented justification -->
composer audit --ignore=GHSA-xxxx-xxxx-xxxx

In practice, I configure --severity=high as the default failure threshold for client projects. Low and moderate severity issues often represent theoretical risks or edge cases that don't apply to your specific usage pattern. Blocking every low-severity advisory leads to alert fatigue, causing teams to disable scanning entirely. Document ignored advisories in a .composer-audit-ignore file or your CI configuration with a comment explaining why the risk is acceptable.

npm Audit for Node.js Frontends

For Laravel applications using Vite 6.x or standalone Node.js services, npm audit remains the baseline. However, its default behavior can be noisy because it includes devDependencies and transitive dependencies you may never execute in production. Use the --production flag to focus on runtime risk.

<!-- Audit only production dependencies -->
npm audit --production

<!-- Fail CI only on critical/high severity -->
npm audit --audit-level=high

<!-- Generate detailed report for review -->
npm audit --json > audit-report.json

A common mistake is treating npm audit fix as a safe automatic solution. In my experience working on production Laravel applications with complex frontend builds, blind auto-fixes frequently break Vite configurations or introduce breaking changes in major version bumps. Always review proposed fixes manually. If a fix requires a semver-major upgrade, treat it as a separate task with proper testing rather than an automated patch.

Developer LocalManual / Pre-commitcomposer auditPHP / Laravel / Symfonynpm auditNode / Vite / VueCI Pipeline GateBlock on High/CriticalDeploy
Native dependency vulnerability scanning setup integrates local audits with CI gates to prevent vulnerable deployments

What Is the Best Automated CI/CD Dependency Vulnerability Scanning Setup?

Local scans protect individual developers, but only CI enforcement protects the project. A reliable CI/CD pipeline must treat vulnerability scanning as a blocking gate, not an informational warning. I typically implement this using GitLab CI or GitHub Actions, depending on the client's infrastructure. The key principle is consistency: the same command that fails CI should also be runnable locally so developers can reproduce and fix issues before pushing.

GitLab CI Configuration Example

For the sister sites I maintain on shared EC2 infrastructure (including legal-tech portals like Notary Kathmandu and Court Marriage In Nepal), the following GitLab CI job runs on every merge request and nightly on the main branch. It uses the official Composer Docker image to ensure a clean environment.

security_audit:
  stage: test
  image: composer:2.7
  script:
    - composer install --no-interaction --no-progress
    - composer audit --severity=high --format=json > audit-results.json
    - |
      if [ -s audit-results.json ]; then
        echo "❌ High severity vulnerabilities detected"
        cat audit-results.json
        exit 1
      fi
  artifacts:
    paths:
      - audit-results.json
    expire_in: 30 days
  rules:
    - if: $CI_PIPELINE_SOURCE == "merge_request_event"
    - if: $CI_COMMIT_BRANCH == "main"
      when: always

Note the artifact retention. Keeping audit results for 30 days allows you to track whether vulnerability counts are trending up or down over time, which is useful for reporting to non-technical stakeholders who need evidence that security hygiene is improving.

Handling False Positives and Acceptable Risk

No scanner is perfect. You will encounter false positives or vulnerabilities that are technically present but practically unreachable in your application. Create an allowlist mechanism rather than disabling the scanner. In Composer, use the --ignore flag with specific GHSA identifiers. In npm, use the .npmrc audit-level or override resolutions. Always document the rationale next to the ignore rule. Undocumented ignores become technical debt that future maintainers cannot safely evaluate.

How Do You Handle WordPress and Legacy PHP Dependency Vulnerability Scanning Setup?

WordPress presents unique challenges because many installations still rely on plugin directories rather than Composer-managed dependencies. Standard composer audit won't detect vulnerabilities in plugins installed via wp-admin. For these projects, your dependency vulnerability scanning setup requires specialized tooling. This is particularly relevant for Nepali businesses running WooCommerce stores where plugins handle payments, bookings, or local integrations like eSewa and Khalti.

WP-CLI Vulnerability Scanner

The wp-cli/vulnerability-scanner package checks installed plugins and themes against the WPScan vulnerability database. Install it as a global WP-CLI package and run it as part of your deployment verification or scheduled maintenance.

<!-- Install the scanner -->
wp package install wp-cli/vulnerability-scanner

<!-- Scan all plugins and themes -->
wp vuln status

<!-- JSON output for CI integration -->
wp vuln status --format=json

<!-- Check only active plugins -->
wp vuln plugin status --active-only

For managed WordPress hosting environments where you cannot install WP-CLI packages globally, consider the Wordfence CLI or Sucuri SiteCheck as alternatives. However, WP-CLI integrates most cleanly into automated deployment pipelines using Deployer 7, which I use extensively for WordPress clients.

Roave Security Advisories for Non-Lock Composer Projects

Legacy PHP applications sometimes lack a composer.lock file or use outdated dependency constraints. Adding roave/security-advisories as a dev dependency prevents installation of known-vulnerable package versions at the resolver level. This acts as a preventive control rather than a detective one.

composer require --dev roave/security-advisories:dev-latest

This approach has limitations: it only blocks installation, not runtime detection, and it can cause dependency conflicts in older projects. Use it alongside, not instead of, active scanning. For modern Laravel 12.x or Symfony 7.x applications with proper lock files, native composer audit is superior.

Project Type?Laravel / Symfonycomposer audit+ Roave (preventive)WordPress / WooWP-CLI Vuln Scanner+ Plugin UpdatesNode.js / Vitenpm audit --prod+ Override ResolutionsAll Projects: CI Gate + Scheduled Nightly Scan + Artifact Retention
Select dependency vulnerability scanning setup tools based on your framework and package manager ecosystem

When Should You Add Commercial Scanners to Your Dependency Vulnerability Scanning Setup?

Native tools cover public CVEs effectively, but commercial scanners add value in specific scenarios: private package repositories, license compliance requirements, reachability analysis (determining if vulnerable code is actually callable), and regulatory compliance like PCI-DSS for eCommerce sites handling credit cards. For most small-to-medium Laravel or WordPress projects in Nepal, native tooling plus disciplined processes is sufficient. Commercial tools become justified when your risk profile or compliance obligations exceed what public databases provide.

ToolBest ForCost (2026)Integration EffortNepal Context Note
Composer/npm AuditAll projects baselineFreeLowWorks offline after install
SnykReachability + private reposFree tier / $25+/moMediumGood for agencies managing multiple clients
DependabotGitHub-hosted projectsFreeLowAuto-PRs helpful for solo devs
WPScan / WordfenceWordPress plugin vulnsFree / $119+/yrLowEssential for WooCommerce stores
Sonatype NexusEnterprise + license compliance$500+/moHighRarely needed for Nepal SMBs

If you're building a custom eCommerce platform processing payments through ConnectIPS or IME Pay, PCI-DSS requirements may mandate commercial-grade scanning with attestation. Budget accordingly — expect NPR 30,000–80,000 annually (~USD 225–600) for adequate coverage. For informational sites, legal-tech portals, or internal tools, free tiers combined with rigorous native scanning typically satisfy due diligence requirements.

How Do You Maintain a Sustainable Dependency Vulnerability Scanning Setup Long-Term?

The hardest part isn't initial setup — it's preventing the system from becoming noise that developers ignore. Sustainability requires three practices: severity-based gating, scheduled reviews, and update discipline.

  1. Gate on severity, not volume. Block CI only on high/critical vulnerabilities. Log medium/low for weekly review. This keeps the feedback loop tight for genuine emergencies while batching lower-priority items into manageable maintenance windows.
  2. Schedule dependency update sprints. Allocate 2–4 hours monthly specifically for addressing accumulated advisories. Treat this as planned work, not emergency firefighting. For clients on retainer, include this in your maintenance agreement explicitly so expectations align.
  3. Pin and verify, don't float. Always commit lock files. Use exact versions for critical dependencies. Test upgrades in staging before production. Automated PRs from Dependabot or Renovate are useful but require human review — never enable auto-merge for security updates without passing your full test suite.
  4. Document your ignore decisions. Every ignored advisory should have a timestamp, GHSA ID, and written justification stored in version control. Review ignores quarterly. Vulnerabilities that were acceptable six months ago may become exploitable as your application evolves.
  5. Monitor upstream channels. Subscribe to security mailing lists for your core frameworks (Laravel Security Advisories, WordPress Security Releases). Scanners have lag; official announcements give you hours or days of advance notice before CVEs propagate to databases.
CI Scan GateBlock High/CriticalTriage & ReviewWeekly BatchUpdate & TestStaging VerificationDeploy SafeProductionMonthly Maintenance WindowReview Ignores + Trend Report
Sustainable dependency vulnerability scanning setup requires scheduled maintenance cycles, not just reactive fixes

Implementing Your Dependency Vulnerability Scanning Setup Today

Start with what you already have. Run composer audit and npm audit --production on your current projects this afternoon. Document what you find. Add the CI gate configuration shown above to your next sprint. Resist the urge to fix everything immediately — triage by severity and business impact. For WordPress sites, install the WP-CLI vulnerability scanner and schedule weekly checks. Only after these foundations are solid should you evaluate commercial tools or advanced features like reachability analysis.

Security is a practice, not a product. A well-maintained native dependency vulnerability scanning setup outperforms a neglected expensive tool every time. If you need help implementing this for your Laravel, WordPress, or Node.js project — especially in contexts where budget and team size constrain your options — reach out to discuss your specific situation. I've helped teams across Nepal and internationally establish sustainable security practices that survive real-world operational pressures.

Frequently Asked Questions

It is the automated process of analyzing composer.lock files against known security databases to identify packages with reported CVEs before deployment.

Basic CLI scanning is free using tools like Composer Audit or Local PHP Security Checker; commercial SaaS solutions typically range from Rs 3,000 to Rs 15,000 monthly.

Run scans on every pull request, nightly via scheduled tasks, and immediately after any composer update or framework upgrade in production environments.

For most Laravel 12 projects, I recommend starting with the built-in composer audit command for CI pipelines because it requires zero configuration and reads directly from your lock file. For teams needing historical tracking or license compliance alongside security checks, Local PHP Security Checker provides a free offline database that works well in air-gapped Nepal infrastructure where external API calls are unreliable. Commercial tools like Snyk offer better remediation advice but add monthly costs that may not justify the expense for smaller client projects.

No, composer audit only checks installed packages against the GitHub Advisory Database at runtime. It lacks historical trend analysis, license compliance checking, and transitive dependency depth analysis that dedicated tools provide. In my experience maintaining legal-tech portals, I use composer audit as a fast gatekeeper in GitLab CI but rely on weekly Local PHP Security Checker runs for comprehensive reporting. Think of composer audit as a smoke test rather than a complete security audit strategy for production applications handling sensitive user data.

Add a dedicated stage in your .gitlab-ci.yml pipeline that runs composer audit --locked before the deploy job executes. Configure the job to fail the pipeline on high-severity vulnerabilities while allowing warnings to pass with logged artifacts. On projects like notarykathmandu.com, I set this up as a blocking gate so vulnerable code never reaches production servers. Store scan results as pipeline artifacts for audit trails. This approach catches issues during code review rather than discovering them post-deployment when remediation becomes urgent and disruptive to ongoing feature development.

Block critical and high severity vulnerabilities immediately as these often have active exploits targeting PHP ecosystems. Medium severity issues should trigger alerts and require documented acceptance or remediation timelines within two weeks. Low severity findings can be tracked in issue backlogs but rarely warrant deployment blocks unless they affect authentication or payment components. In practice, being too aggressive with medium/low blocks causes developer fatigue and leads to teams disabling scans entirely. Balance security rigor with delivery velocity based on actual risk exposure.

Verify each flagged vulnerability against the official CVE database and package maintainer advisories before accepting or dismissing. Some scanners flag theoretical vulnerabilities in unused code paths or misidentify patched versions. Document accepted risks in a SECURITY.md file with justification and review dates. On eCommerce projects processing payments, I maintain stricter validation standards than brochure sites. Never blindly ignore findings without verification as this undermines the entire scanning program and creates compliance gaps during future security reviews or client audits.

Standard public scanners cannot analyze proprietary packages since they lack access to private repositories. You must implement internal scanning using tools like Local PHP Security Checker with custom advisory feeds or commercial solutions supporting private registry integration. For Laravel applications with custom vendor packages, ensure your private repository metadata includes accurate version constraints and changelogs. In my work building client-specific modules, I treat private packages with equal scrutiny as public ones since supply chain attacks increasingly target internal dependencies that receive less community security review.

Update local vulnerability databases daily if running automated scans, or before each manual assessment. Tools like Local PHP Security Checker bundle databases requiring explicit updates via their CLI commands. Cloud-based scanners handle this automatically but depend on internet connectivity. On Nepali server infrastructure with intermittent connectivity, I schedule database syncs during off-peak hours and cache results locally. Stale databases miss newly disclosed CVEs, creating false confidence. Always verify database freshness timestamps in scan reports before trusting negative results on production systems.

Software Composition Analysis (SCA) examines third-party dependencies for known vulnerabilities in published packages. Static Application Security Testing (SAST) analyzes your own source code for security flaws like SQL injection or XSS. Both are necessary but address different attack surfaces. Dependency scanning alone won't catch insecure coding patterns in your controllers or models. On Laravel projects, I combine composer audit for SCA with PHPStan security rules for SAST. This layered approach catches both supply chain risks and application-level vulnerabilities that could compromise user data or system integrity.

Focus first on vulnerabilities affecting runtime dependencies actually loaded during request cycles, not dev-only testing tools. Cross-reference CVE scores with your application's exposure surface; an RCE flaw in an image library matters more if you process user uploads versus generating static PDFs internally. Check exploit availability and patch feasibility before committing resources. In my experience upgrading legacy Laravel applications, grouping related updates reduces testing overhead. Create a remediation roadmap addressing critical items weekly while batching lower-priority fixes into monthly maintenance windows to avoid constant context switching.

Lightweight tools like composer audit add ten to thirty seconds to typical Laravel pipelines, which is negligible compared to test suites. Comprehensive SCA tools may take several minutes depending on dependency count and database size. To minimize impact, run fast checks on every commit and schedule thorough scans nightly or on merge requests only. Cache dependency databases between pipeline runs to avoid redundant downloads. On shared EC2 infrastructure hosting multiple sister sites, I parallelize scanning jobs to prevent bottlenecks during peak development hours when multiple teams deploy simultaneously.

Most scanning tools support configuration files listing CVE IDs or package versions to exclude from failure conditions. In composer audit, use the --ignore flag or configure exceptions in composer.json under the audit section. Document each exception with business justification, risk assessment, and expiration date. Review allowlists quarterly to remove resolved issues. On legal-tech platforms, I maintain separate allowlists per environment since staging tolerances differ from production. Never make allowlists permanent without scheduled reviews as this accumulates technical debt and obscures real security posture over time.

Container scanning tools like Trivy analyze Docker images including all OS-level and language dependencies in unified reports. GitHub Dependabot and GitLab Dependency Scanning integrate natively with repository platforms for automated PR creation. Commercial platforms like Snyk or Socket provide deeper reachability analysis showing whether vulnerable code paths are actually executed. For Nepal-based teams managing mixed stacks, container scanning offers consistency across PHP, Node.js, and system packages. Choose based on infrastructure complexity; pure PHP projects rarely need enterprise platforms unless operating at scale with strict compliance requirements demanding centralized dashboards and audit reporting.

Share this article

Quick Contact Options
Choose how you want to connect me: