⚡ ~/naveed Interview Prep
⚡ Portfolio Home 👤 About Naveed Bio & Credentials 📫 Contact Naveed Get In Touch ✍️ Engineering Blog Deep Dives 🎯 Interview Hub 1,000+ Scenarios ☸️ Kubernetes Mastery Hub 24 Modules 🎮 DevOps Arcade & Quizzes Subnet Blitz ⚡ 🗺️ DevOps Roadmaps PDFs & Guides 🤖 Morpheus Analysis AI Quant ↗ 🛠️ Developer Tools Utilities 🧪 Labs & Experiments 📄 Interactive CV & Certs 🔗 All Links & Socials ⚡ Join The Dispatch (Weekly SRE Newsletter) →
← Back to All Git & Branching Workflows Interview Questions Scenario 19 of 52 in Git & Branching Workflows
Staff SRE / Principal Architect [L3] Git Advanced Staff SRE Scenario [L3]
🎯 Target Role / Context: Git Scenario #19 (L3) · Advanced

Q: Your company is enforcing supply-chain integrity. The CISO wants every commit on `main` to have a verifiable author and to be tamper-evident. How do you implement this, and what attack does it actually prevent?

By default, Git's Author and Committer headers are unauthenticated free-text — anyone can run git config user.email "ceo@company.com" and produce commits that look like the CEO. Signing fixes that with cryptographic proof.

#Git #Advanced #L3 #Version Control #Collaboration
🎙️ Candidate Opening & Architectural Context
""During a major release branch cut, we encountered this exact scenario and used Git internals to recover cleanly. The interviewer is testing: Understanding of commit signing, identity vs authorship, and threat modeling.. I structure my answer around systematic triage first, root cause analysis second, and permanent remediation third.""
Advertisement
⚡ Recommended Practice Lab

Want to master this scenario in a live sandbox? KodeKloud's Advanced Git Workflows, Rebase & Interactive Diagnostics covers this exact problem with hands-on terminal drills.

🛠️ Production Runbook & Step-by-Step Resolution

Direct Answer: "During a major release branch cut, we encountered this exact scenario and used Git internals to recover cleanly. The interviewer is testing: Understanding of commit signing, identity vs authorship, and threat modeling.. I structure my answer around systematic triage first, root cause analysis second, and permanent remediation third."

1️⃣

Initial Diagnostics & Root Cause Analysis

By default, Git's Author and Committer headers are unauthenticated free-text — anyone can run git config user.email "ceo@company.com" and produce commits that look like the CEO. Signing fixes that with cryptographic proof.

  • Signing keys per developer. Either GPG (traditional) or SSH signing (Git ≥ 2.34, much simpler — reuse the SSH key engineers already have):
  • Allowed-signers file mapping email → public key, distributed via your IDP / SSO so trust is centralized, not per-laptop.
  • Upload the public key to GitHub/GitLab under "Signing key." Now the platform shows a "Verified" badge and exposes verification status via the API.
  • Branch protection on main — require signed commits, require linear history, require status checks. Block merges where any commit is unsigned.
  • CI verification — a pre-merge job that runs git verify-commit against each commit in the PR, failing if any commit isn't signed by a key in the allowed-signers list. Don't rely solely on the platform UI badge.
  • CODEOWNERS to require domain-expert review on sensitive paths (e.g. /infra/, /auth/, CI workflows themselves).
2️⃣

Remediation & Permanent Safeguards

Implementation: What this actually prevents: What it does not prevent: Signing answers "who wrote this commit?" with cryptography. It does not answer "is this code safe?" — that's a separate problem.

git config --global gpg.format ssh
   git config --global user.signingkey ~/.ssh/id_ed25519.pub
   git config --global commit.gpgsign true
   git config --global tag.gpgsign true
  • Author spoofing — an attacker who compromises one developer's laptop can no longer forge commits as a different developer (different key).
  • Tampering with merged history — if someone with repo-admin access tries to silently rewrite a past commit, the signature on the original commit chain breaks and CI rejects it.
  • Compromised CI tokens pushing arbitrary code as humans — unsigned commits are blocked, so a leaked PAT can't ship merge-able changes without a key.
  • A compromised developer laptop with their key on it — the attacker's commits will sign correctly. Mitigations: hardware-backed keys (YubiKey for GPG, or SSH keys in ssh-agent with confirmation), short-lived keys via SSO-issued certificates, and behavioral monitoring.
  • Malicious code that's *legitimately* authored and signed (insider threat, social-engineered review). That's what CODEOWNERS, mandatory review, and SCA tooling are for.
💡 The Senior SRE Gold Nugget (Key Architectural Takeaway)
"Pro-Tip: Signing keys per developer. Either GPG (traditional) or SSH signing (Git ≥ 2.34, much simpler — reuse the SSH key engineers alread."
⚡ 60-Second Elevator Pitch Talking Points
  • Signing keys per developer. Either GPG (traditional) or SSH signing (Git ≥ 2.34, much simpler — r...
  • Allowed-signers file mapping email → public key, distributed via your IDP / SSO so trust is centr...
  • Upload the public key to GitHub/GitLab under "Signing key." Now the platform shows a "Verified" b...
⛔ Critical Candidate Mistakes to Avoid in This Scenario

Senior hiring managers and bar raisers evaluate how you prioritize during outages. Avoid these common anti-patterns:

  1. Running raw git push --force rather than git push --force-with-lease on shared team feature branches when configuring company enforcing supply git push --force unconditionally overwrites remote commits made by teammates, whereas --force-with-lease aborts if the remote ref was updated.
  2. Resolving complex merge conflicts with blind checkout overwrite strategies without running unit tests when configuring company enforcing supply Unilateral conflict resolution frequently clobbers complementary logic introduced in parallel feature branches, creating regression bugs.
  3. Discarding corrupted working directories prematurely instead of recovering lost state using git reflog when configuring company enforcing supply git reflog tracks every HEAD movement, allowing instant recovery of discarded commits, botched rebases, or deleted local branches.
  4. Disabling branch protection rules and mandatory PR approval reviews on shared release branches when configuring company enforcing supply Without branch protection, developers can bypass CI validation gates and push untested code directly to production branches.
Advertisement
Want more Git & Branching Workflows scenarios?
Explore our complete collection of scenario-based Git & Branching Workflows interview runbooks.
Browse All Git & Branching Workflows Questions →