Vercel project has automatic exposure of system environment variables disabled
Vercel projects are assessed for automatic system environment variable exposure (VERCEL_URL, VERCEL_ENV, VERCEL_GIT_COMMIT_SHA). When enabled, these variables are injected into every deployment and may be accessible in client-side JavaScript bundles if not handled carefully, leaking internal infrastructure details.
Risk
Automatically exposed system environment variables can reveal deployment URLs, Git metadata, environment names, and other internal details. If these values are inadvertently included in client-side bundles, attackers can use them to map infrastructure, identify staging environments, or craft targeted attacks against specific deployment instances.
Run this check with Prowler
Run in Prowler Cloudprowler vercel --checks project_auto_expose_system_env_disabledRecommendation
Disable automatic exposure of system environment variables and explicitly define only the variables required by your application. This follows the principle of least privilege and reduces the risk of leaking internal infrastructure details through client-side code.
Remediation
Other
Check Code
from typing import List
from prowler.lib.check.models import Check, CheckReportVercel
from prowler.providers.vercel.services.project.project_client import project_client
class project_auto_expose_system_env_disabled(Check):
"""Check if automatic exposure of system environment variables is disabled.
This class verifies whether each Vercel project has the automatic exposure
of system environment variables disabled to prevent information leakage.
"""
def execute(self) -> List[CheckReportVercel]:
"""Execute the Vercel Project Auto Expose System Env check.
Iterates over all projects and checks if automatic exposure of system
environment variables is disabled.
Returns:
List[CheckReportVercel]: A list of reports for each project.
"""
findings = []
for project in project_client.projects.values():
report = CheckReportVercel(metadata=self.metadata(), resource=project)
if not project.auto_expose_system_envs:
report.status = "PASS"
report.status_extended = (
f"Project {project.name} does not automatically expose "
f"system environment variables to the build process."
)
else:
report.status = "FAIL"
report.status_extended = (
f"Project {project.name} automatically exposes system "
f"environment variables to the build process."
)
findings.append(report)
return findings