Case study · A marketplace on Google Cloud

Harbour

A small marketplace on Google Cloud, built the way real platforms get built: one reasonable shortcut at a time. Read how it works, follow its traffic, then take apart the 17 things wrong with it.
business
Online marketplace · independent sellers
team
Four engineers, one of them on platform
host project
harbour-net-prod
VPC
harbour-vpc · custom mode · global routing
regions
asia-southeast1 · asia-south1 standby

Harbour is a fictional marketplace running on Google Cloud, and its network is deliberately misconfigured. Every problem in it is one I put there on purpose, because the point is not the architecture - it is the reasoning about what is wrong with it, why it is wrong, and what order the fixes have to happen in.

I built it while working through GCP networking end to end. The defects are the kind that appear in real projects: each one started as a reasonable short-term choice that nobody revisited. None of them is obvious from a diagram, which is why this case study follows the traffic instead.

What this is not: a production template, a best-practice reference, or an audit of any real system. Names, addresses and identifiers are invented.

How to read it

Three parts, in order. The platform first, so the names mean something; then the traffic, so you see the defects doing damage; then each defect on its own.

  1. 2.Platform4views of how it is builtMap · IP plan · Components · Load balancing
  2. 3.Packet journeys6flows traced hop by hopEach one as found, then fixed. Watch where the packet stops.
  3. 4.Defects17things wrong with it3critical5high7medium2low

The business

Harbour runs an online marketplace for independent sellers - makers, small shops, a few hundred workshops across Southeast Asia - and takes a commission on every sale. Four things keep it alive, and each one is a path through the network you can follow:

  • Product pages load fast

    Most traffic is browsing. It comes through Cloudflare, then Google's load balancer, then the API. A slow or broken page is lost revenue.

    Runs intoD6D8D5D15Follow it

  • Checkout charges the card

    Payments go to PayGate, which accepts calls only from addresses Harbour has registered. If the source address drifts, checkout fails.

    Runs intoD7Follow it

  • Sellers get paid

    A nightly job gathers the day's orders and queues the payouts through a message broker. Nobody watches it, so it has to fail loudly.

    Runs intoD4Follow it

  • Orders reach the courier

    A delivery partner reads order status from Harbour's systems over a private network link. Without it, parcels sit on shelves.

    Runs intoD11Follow it

How it got this way

Nobody designed Harbour to be insecure. Every defect is a decision that made sense on the day, made by a small team moving fast, and never revisited. Open one to read how it happened.

Year one

One server group, open to everyone

Left behindD3bD2D3aD16D1

The first version was a single group of VMs, legacy-api, each with its own public address. SSH was opened to the internet so the founders could deploy from anywhere, a bastion got a public address of its own, and everyone's keys went into project metadata. During a late-night outage someone added a rule allowing everything in. It fixed the outage and never came out.

Year one

A database you could reach from home

Left behindD5

Cloud SQL went in with a public IP so the team could query it from their laptops. Each engineer's home broadband address went on its allow-list.

Year two

The new API moves to Cloud Run

Left behindD6D7

The new API shipped on Cloud Run, and its run.app URL worked on day one. The load balancer came later, in front of it, and nobody went back to close the original door. The egress setting was picked because it reached the database - and it did, so nobody noticed it was wrong for everything else.

Year two

Bots hit the product pages

Left behindD8D14D15

A wave of scraping took the product pages down, so Cloudflare went in front and a WAF policy went on the new API's backend. The load balancer was never told to accept traffic only from Cloudflare, the old backend never got the WAF, and the TLS settings stayed at their defaults.

Year three

Half of a good idea

Left behindD4D12D13

The message broker went into a private subnet with no external address - the right call - but the subnet never got Private Google Access, so the broker cannot reach any Google API. An internal load balancer for the legacy API was planned and stalled when the create command failed, and the legacy backend kept its old TCP health check.

Year three

A courier joins

Left behindD11

The delivery partner peered its network with Harbour's for a pilot, expecting to read order data straight from Harbour's managed services. The pilot is still waiting.

Throughout

Nothing above, nothing out

Left behindD10D9

Every engineer is an owner and nothing sits above the project, so any of them can change any rule. No egress rule was ever written, so every machine can reach anywhere on the internet.

What it covers

  • Routing

    • Route types
    • Longest prefix versus priority
    • Tag-scoped routes
    • Why priority never beats specificity
  • Firewall

    • Distributed enforcement
    • Stateful return traffic
    • Rule scoping
    • The implied rules at 65535
    • Hierarchical policies
  • Private connectivity

    • Private Google Access
    • Private Service Access
    • Private Service Connect
    • Which one solves which problem
  • Egress

    • Cloud NAT
    • Port exhaustion
    • The static egress IP pattern
    • Cloud Run’s two egress modes
  • Load balancing

    • The four axes
    • Proxy versus passthrough
    • The component chain
    • Health checks
    • Where Cloud Armor attaches
  • Secure access

    • IAP TCP forwarding
    • OS Login versus metadata keys
    • VMs with no external IP

The remediation sequence

Seventeen problems is a list. The order they have to be fixed in is the argument. Several cannot start until another is finished, and one of them is dangerous to do at any point other than last.

  1. Phase 1: Groundwork

    Purely additive. Nothing can break, and both changes unblock later phases.

  2. Phase 2: Secure access

    Depends on nothing, and everything after it is safer once administrative access no longer runs over a public SSH port.

  3. Phase 3: Close the bypasses

    Makes the protections that already exist actually apply. Cheaper than adding new ones.

  4. Phase 4: Private data path

    Needs Private Google Access from phase 1, and the external IPs cannot come off until the database is reachable privately.

  5. Phase 5: Egress and load balancer

    The egress deny needs every external destination enumerated first, which you only know once the NAT path is proven.

  6. Phase 6: Govern and tighten

    Deleting the allow-all rule goes last, because it is the moment you find out what was quietly relying on it.

The Map walks the whole platform through these phases. Every packet journey and every defect page can be read two ways: as found, and fixed.

Conventions

ThingMeaning
criticalDirectly exposes data or grants access to the internet
highRemoves a protection that is assumed to be working, or breaks silently
mediumWeakens a control, or blocks a hardening step that depends on it
lowCauses confusion or a failed change rather than exposure
phase 1–6Which step of the sequence closes it. Ordering is the point - several defects cannot be fixed until another is.
As found · FixedOn every journey and defect page. As found is Harbour today; Fixed is Harbour with the defects closed.
Phase railOn the Map. Move along it and the boxes and defect badges change to that point in the sequence.