Home / Core Health / Block access to composer.json and package.json
Exposed Files · Scan Check Guide

Block access to composer.json and package.json

15 min Impact: medium Effort: low ✓ Scan-verified — no manual checkbox

Dependency manifest files (composer.json, package.json, requirements.txt) list every library and framework your application uses, with exact version numbers — publicly readable, this hands attackers a precise shopping list of known vulnerabilities to try against your specific stack.

composer.json and package.json list your exact dependency versions — a ready-made target list for attackers checking each one against known CVEs, instead of having to guess what you're running.

The full picture

Publicly accessible composer.json and package.json files reveal your exact dependency list — every third-party library and package your site relies on, often including specific version numbers — providing an attacker with a genuine, detailed roadmap of exactly which dependencies to check for known vulnerabilities specific to your site's actual technical stack.

This represents a particularly efficient reconnaissance opportunity for attackers, since rather than needing to guess or probe for what technologies your site uses, this file provides a complete, explicit list with specific versions — dramatically narrowing the research required to identify a specific, exploitable vulnerability in your actual dependency stack.

The genuine risk scales with your dependency count and the currency of your version management — a site with many dependencies, some potentially outdated, exposed through this file provides an attacker with numerous specific, documented vulnerability possibilities to investigate, each representing a real potential attack vector into your specific site.

Blocking public access to these files, while ensuring your actual dependency management and update processes continue functioning normally for legitimate development and deployment purposes, closes off this specific reconnaissance opportunity without affecting your genuine technical operations, since these files are meant for build-time and development use, not public runtime access.

How to fix it

  1. 1
    Check what's exposed
    Visit yoursite.com/composer.json, /package.json, or /requirements.txt depending on your stack.
  2. 2
    Block direct access at the server level
    These files should never need to be served publicly — add a rule denying direct requests to them.
  3. 3
    Confirm your build process doesn't ship them to production
    Ideally these files stay in your build/deploy pipeline and never get copied into the actual public web root.

Common mistakes

How you'll know it's done

Dependency manifest files return 403/404 when requested directly over the web.

H.I.V.E. checks this automatically

Fix it, then re-scan — the check confirms itself. No manual checkbox, the scan is the truth.

Run this check in H.I.V.E. →