API inventory gaps: shadow, zombie, and undocumented endpoints

You cannot protect APIs you do not know about. How old versions, debug routes, and undocumented services stay reachable, and how to build an inventory from gateways, traffic, specs, and DNS.

Lesson 39 of 69 · 10 min read · practice only with authorization

Diagram

Building an API inventory from four sources

Follow the path. One example at a time.

Step 1 of 4

Specs

OpenAPI files in repositories list intended routes.

Illustration: Specs
$ fd -e yaml -e json openapi . | wc -l
14

The example on the open step is one illustration, or the fix you can paste into an application you own.

What this page is made of

3 pieces. Each one says what fails, who is affected, what you would notice, and what you change.

  1. Zombie versions

    What fails
    An old API version stays live after clients moved on, without the newer checks.
    Who is affected
    Users whose data the old version still serves.
    What you would notice
    Traffic on /v1 paths after a v2 launch.
    What you change
    Announce sunset dates, return Sunset headers, then remove the route.
  2. Shadow endpoints

    What fails
    Routes added outside the spec, such as debug or partner-only paths.
    Who is affected
    Whatever the undocumented route touches.
    What you would notice
    Paths in logs that appear in no OpenAPI file.
    What you change
    Require a spec entry for every gateway route.
  3. Ownerless services

    What fails
    Nobody patches or reviews an API without an owner.
    Who is affected
    Users of an unmaintained service.
    What you would notice
    Inventory rows without a team.
    What you change
    Assign an owner or schedule the service for removal.

Hosts as well as paths

API hosts hide in DNS: api-old, staging-api, partner-api. Certificate transparency logs and your own DNS zones list them. The subdomain discovery tools in the tool library, such as subfinder and amass, help build that list for domains you own.

Retiring an endpoint cleanly

Announce, measure, and remove. Sunset and Deprecation headers tell clients in-band, and gateway logs show when traffic reaches zero.

Deprecation: true
Sunset: Thu, 31 Dec 2026 23:59:59 GMT
Link: <https://developer.example.test/migrate-v2>; rel="sunset"

Check yourself

Recognition and the fix. Nothing here is a procedure.

1 / 3

Logs show steady traffic on /api/v1/orders a year after v2 launched. What is the risk?

Sibling techniques

Pages at the same depth, plus a lab and a glossary card for this one.

  1. MapAPI security as an environmentModern products are APIs with a few front ends.
  1. 01Broken API authentication: tokens, keys, and the checks that get skippedCommon API authentication failures: unvalidated JWT claims, API keys in URLs, missing rate limits on token endpoints, and long-lived tokens.
  2. 02API security misconfiguration: defaults, debug modes, and permissive CORSThe configuration mistakes that turn a sound API into an exposed one: debug endpoints, verbose errors, wildcard CORS with credentials, open documentation consoles, and missing TLS settings, with a scan-and-fix workflow.
  3. 03Injection through API fields: JSON bodies reaching SQL, NoSQL, and shellsWhy JSON APIs are still injection targets: operator injection in MongoDB-style queries, typed fields that are never type-checked, and filter parameters passed to query builders.
  4. 04Unsafe consumption of third-party APIs: treating partner data as trustedWhen your service calls a partner or SaaS API, its responses are input too.
  5. 05GraphQL security: introspection, resolver authorization, and query costWhere GraphQL APIs go wrong — missing authorization in resolvers, unbounded nested queries, batching that defeats rate limits, and injection in resolver code — and how to review a schema and test it with a tool like InQL or graphql-cop.

Practice

  1. LabControl benchA failure is described. Choose the control that changes the outcome.

Glossary

  1. CardAPI inventory gapsA forgotten version or a shadow method stays on the internet after the product moved on.