Script Rescue · legacy maintenance

Keep the behaviour. Remove the accidents.

Inherited CGI applications rarely need a heroic rewrite first. They need an inventory, a reproducible request contract and one safe boundary at a time.

Maintenance desk

Two rescues, two different jobs.

These are new editorial works under the current operator. They do not reproduce the former site’s code, manuals or authorship.

PublishedMigration guide12 min

From CGI to PSGI without changing behaviour

Problem
The script mixes HTTP, business rules, files and process assumptions.
Decision
Freeze the HTTP contract before moving the execution boundary.
Result
A staged path that keeps rollback possible and exposes persistent-process bugs early.

Editorial check

PublishedCode reading17 min

A 1998 CGI guestbook, read line by line

Problem
A small script carries several vulnerability classes.
Decision
Trace input, output and storage instead of judging the syntax by age.
Result
A bounded rewrite that preserves the visible behaviour and drops unsafe assumptions.

Editorial check

The method

Observe before you modernise.

A rescue starts with requests and responses: paths, methods, parameters, redirects, headers, side effects and failures. Architecture comes after that evidence exists.

  1. 01RecordCapture representative traffic and edge cases without collecting secrets.
  2. 02CharacteriseTurn observed behaviour into tests at the HTTP boundary.
  3. 03SeparateExtract parsing, decisions and persistence behind explicit interfaces.
  4. 04SwitchChange one deployment boundary with rollback and logs in place.