Track 09 · Lesson 9 of 9Shipping safely

Track 09 · Shipping safely

Cleaning up after yourself

Lesson 9 of 9· 6 min

Your attack surface is everything an attacker can touch: endpoints, files, credentials, deploy paths, DNS records. Unused ones add risk with no benefit. Removing them is the cheapest security work there is.

Eight leftovers

Decide what to do with each

  • .github/workflows/deploy-heroku.yml: the app moved off Heroku in 2024
  • HEROKU_API_KEY repository secret, last used 14 months ago
  • /api/debug/logs, commented “TEMPORARY, remove after the outage”. An admin page now reads it
  • function isAdmin() { return true } // TODO real check, used by /api/admin/export
  • Cloud access key created by a former contractor, last used 400 days ago
  • DNS: staging.example.com points at a cloud app that was deleted
  • 140 old image tags in the registry, including the current and rollback images
  • scripts/seed-prod.sh with the production database password written in it

0 of 8 doors closed

Delete the thing, revoke what it used#

Removing a dead workflow is half the job; the key it used still works until you revoke it. Every deletion has a second question: what credentials, DNS records or permissions existed only for this?

Temporary code is permanent until removed#

Debug routes and loggers added during an incident keep running after it ends, usually without the rate limits, authentication and review a real feature gets, and other code starts depending on them. Decide on purpose: remove it all, or adopt it properly.

Make it a habit#

Delete one unused file, key or record every week until there’s nothing left to delete. Search for TEMPORARY, HACK, remove after and TODO near auth code. Review who has access, and keys nobody has used in months.

Where this track leaves you#

You’ve followed a secret from creation to leak, a pull request into CI, a package from advisory to patch, and a token through every log it touches. The capstone puts it all together: an audit of a whole project, a launch checklist, and a final exam.

In a code review

LowAll

Dead code, temporary tools and stale credentials

Fix: Delete what is unused, revoke what it used, and either remove temporary tools or adopt them properly.

0 of 4 checked

Check yourself

staging.example.com still points at a cloud app you deleted. What’s the risk?