Replacing a Dependency You Cannot Patch¶
Learning objectives
By the end of this module you should be able to:
- Explain why an unmaintained dependency is a security problem even when nothing has gone wrong with it yet.
- Describe why a migration structured as a copy is categorically safer than one structured as a move, and what that buys at every step.
- Distinguish a check that proves a copy happened from one that proves the copy is usable, and say why only the second should gate a cutover.
- Recognise the failure mode where a migration's "failures" are actually defects in the tools used to verify it.
The dependency that stops moving¶
Every platform is built partly from components someone else maintains. Most of the time that is leverage. Occasionally a component you depend on stops being maintained: the repository is archived, releases stop, security patches stop.
Nothing breaks that day. That is what makes it dangerous. The software keeps working exactly as well as it did yesterday, so there is no alarm, no incident, no page. What has changed is invisible: every vulnerability discovered from now on is permanently yours. You have silently taken on maintenance of software you did not write and cannot realistically fix.
For an ordinary utility that might be tolerable. For the layer holding your customers' documents, it is not — and in a regulated setting it is the kind of thing a vendor review finds and asks pointed questions about.
So you replace it. The interesting engineering question is how to replace a foundational component without the replacement becoming the incident.
Copy, never move¶
The single most valuable structural decision is to make the migration a copy rather than a move: the old component keeps every byte until the very end.
This sounds obvious and is routinely violated, because moving feels tidier and cheaper — you avoid storing two copies, and you avoid the "which one is authoritative?" question. But a move makes every step one-way. If step four of six reveals a problem, you cannot simply stop; you have to recover forward, under pressure, with the thing you were migrating away from already partly gone.
Copying inverts that. At every step the previous component is still intact and still capable of serving, so "roll back" means pointing at it again rather than restoring from a backup. The cost is temporary duplicate storage, which is almost always cheaper than the alternative.
The same discipline applies to how you copy. A synchronising mirror that makes the destination match the source exactly will faithfully propagate a deletion — which is the wrong semantics for a safety copy. An additive mirror, which only ever adds and overwrites, means an accidental deletion on one side cannot destroy the other side too.
Move consumers one at a time¶
Once the data is copied, several components must be repointed at the new one. It is tempting to switch them together — one change, one restart, done.
Doing them one at a time is better for a reason that has nothing to do with caution and everything to do with diagnosis. If you move six consumers at once and something misbehaves, you have six suspects and a compound failure. If you move one, the suspect list has one entry, and the fix is to reverse one small change.
Order them by two properties: how loudly a failure would announce itself, and how cheaply it could be undone. Start with something that fails obviously and recovers in seconds; finish with the component that is slowest and fussiest to restart. That way the risky one runs last, with everything before it already proven.
The check that should gate the cutover¶
Here is the subtle part. After copying, the obvious verification is to count objects on both sides and confirm the numbers match.
That check is necessary and badly insufficient. Matching counts prove that a copy happened. They do not prove the copy is usable by the application — that every record the system believes exists can actually be fetched, under the exact name the system will ask for.
The stronger check reconciles against the system of record: take the authoritative list of what should exist, and verify each entry resolves in the new store. That catches naming mismatches, encoding differences, and subtly truncated identifiers — none of which move the object count at all.
Make that reconciliation the gate. Counts are a smoke test; reconciliation is the evidence.
Migrate privileges while you are there¶
A replacement is a rare moment when you configure access from scratch rather than inheriting it. That is much cheaper than retrofitting, so take it.
The pattern worth adopting: give every consumer its own credential, scoped to only the data it actually needs. A component that only reads should not hold a credential that can write. A component that manages policy should not be able to rewrite its own policy. A backup process should be able to read everything and write nothing — so that compromising it cannot corrupt the very data it exists to protect.
Retrofitting this later means touching every consumer twice. Doing it during the migration means touching them once.
When the tools lie to you¶
A migration involves a great deal of ad-hoc verification: shell one-liners, throwaway scripts, quick probes. Those are software too, and they are software written quickly, under time pressure, without tests.
It is entirely possible — common, even — for a migration to appear to fail when the thing that actually failed was the check. A probe that silently sends an empty credential. A comparison that runs over an empty list and reports success having verified nothing. A parser that truncates any name containing a space. A configuration file that ends up empty and is accepted without complaint.
Each of those produces a confident, wrong answer, and each can send you hunting for a bug in a system that is behaving perfectly.
Two habits defend against it:
- Assert the denominator. A check that reports "all 0 records verified" should fail loudly, not pass. If your gate can pass on empty input, it is not a gate.
- Ask the system what it thinks its state is, before theorising about why it is behaving oddly. Most systems can report their own loaded configuration. One such query can falsify a dozen hypotheses at once and is nearly always faster than inference from black-box behaviour.
And a rule of thumb: if a well-tested system appears to be failing non-deterministically, suspect your instrument before you suspect the system.
The takeaway
Replace an unmaintained dependency deliberately, before it becomes an incident. Structure the work as a copy so that no step is one-way, move consumers one at a time so a failure has exactly one suspect, gate the cutover on reconciliation against the system of record rather than on object counts, and take the free opportunity to give every consumer only the access it needs. Then, when something looks wrong, check the instrument first.