Interview Prep/DevSecOps/Supply Chain Security

Your internal package `acme-utils` exists in a private registry. How do you prevent dependency confusion?

AdvancedScenarioSupply Chain Security
Answer

Situation read → If the package manager checks a public registry too, an attacker can publish acme-utils with a higher version and win resolution.

What I'd do →

  1. Use scoped or namespaced names: npm @acme/utils; register the scope publicly as well.
  2. Configure the client to route the scope to the private registry: @acme:registry=https://npm.acme.internal/.
  3. In pip, avoid --extra-index-url; use a single proxy index with exclusion rules.
  4. In Maven/Gradle, use repository content filtering for the group.
  5. Use lockfiles with hashes and block resolution of internal names from public upstream in Artifactory or Nexus.

Why → Namespace ownership and a single resolution path remove the ambiguity.

Interview tip → Cite Alex Birsan's 2021 research as the origin.

All DevSecOps questions Roadmap: Supply chain, secrets & identity

More on Supply Chain Security