Safeguard
Security Guides•

Emergency package fix only in prod: how to reconcile the drift

After a prod-only emergency package fix, write it down, replay it in source control, rebuild, and verify. Here is the routine that closes the gap.

Safeguard Security Team
3 min read

After an emergency fix applied only in production, treat the change as a loan: record exactly what changed, replay it in source control within a day or two, rebuild through the normal pipeline, and verify that prod and staging now match. Until then, your tested code is not your running code.

Why emergency fixes cause drift

Under pressure, someone upgrades a library on a live host or builds a one-off image. It works, the incident ends, and nobody updates the repository. Weeks later staging still holds the old package, the next deploy overwrites the fix, and the problem returns. Or the fix survives and nobody knows it exists.

The reconcile routine

  1. Capture the change while it is fresh. Record the package, old version, new version, host or image, who made it, and why. A chat message is not enough; use a ticket.
  2. Snapshot the production state after the change. An installed package list is enough.
  3. Replay the change in the repository: update the manifest and lockfile in a pull request that references the ticket.
  4. Test the change in staging with the normal checks.
  5. Rebuild and redeploy through the pipeline so production runs a built artifact, not a hand-edited one.
  6. Compare. Export installed packages from staging and production and confirm they match. See how to compare installed packages.
  7. Close the ticket only after step 6.

Set a deadline. Two business days is a reasonable starting point for a security fix; adjust to your release cadence.

Reduce the need for it

CauseControl
No fast path through the pipelineBuild an expedited lane that keeps scans and approvals but skips slow optional tests
Shell access on prod hostsRestrict it and log it
Mutable serversMove to rebuilt images
Nobody owns driftName an owner per service

The expedited lane matters most. People bypass pipelines that take hours when a fix takes minutes. A lane that takes twenty minutes and still records an artifact removes the temptation.

Common mistakes

  • Fixing production and forgetting that dev and staging remain vulnerable.
  • Replaying the fix with a different version than the one running in prod.
  • Rebuilding without a lockfile, which pulls in unrelated newer versions along with the fix.
  • Closing the incident ticket without a drift check.

Try it yourself

Click through it at your own pace, or open it full screen.

See how a fix path is presented as a concrete version change. The same detail belongs in your reconcile ticket.

What Safeguard does here

Safeguard monitors dependencies against new advisories and can open fix pull requests, though autonomous remediation is off by default and every category starts on Manual, so a human decides. Try the free scan at gold.safeguard.sh/scan.

Quick check

Is it ever fine to patch prod by hand?

In a real emergency, yes, as long as it is recorded and reconciled quickly. The risk is leaving it undocumented.

Who should own the reconcile?

The person who made the change, with the service owner confirming the final comparison.

Last reviewed: 19 October 2026.

Never miss an update

Weekly insights on software supply chain security, delivered to your inbox.

Self-healing security runs on Safeguard.

Your first fix PR is minutes away.

No sales call required, even your agent can complete the purchase over MCP.