Mercurial supply chain security is now a critical risk vector. Attackers exploit dependencies, distribute poisoned repositories, and slip malicious commits into projects. Once inside, compromised code can steal credentials, exfiltrate data, or open persistent backdoors. The speed of modern development means these threats can spread faster than they can be detected.
Mercurial, unlike Git, has unique repository formats, extension APIs, and transport protocols. Each creates specific attack surfaces. Unverified extensions can run arbitrary Python code upon installation. Repository cloning from untrusted servers can allow crafted manifests to trigger exploits in client tooling. Weak authentication on remote endpoints invites hijacking by malicious mirrors.
A secure supply chain in Mercurial requires strict provenance checks. Every incoming commit should be verified against trusted signatures. Enforce immutable history policies to block unexpected rewrites. Apply minimal-access permissions to hooks and scripts. Audit extensions before deployment. Monitor clone sources for sudden behavior changes or mismatched hashes.