skip to content

html, css, and dom · lesson 7 of 8 · sources checked 2026-11-20

serve plausible but changed data, and detect it

This lesson builds a lab switch that serves changed data with status 200, and three checks that show which change a collector finds.

purpose

A site can answer a flagged client with a normal page that holds wrong values. This defense is data poisoning. It has no block page and no error status, so the collector must find the change in the values.

objectives

  1. Build a lab switch that serves changed data with status 200 to a flagged client. Serve changed prices, decoy listings, stale data, or removed items.
  2. Describe the three checks of the collector and the change that each check finds.
  3. Explain why changed data costs the operator more than a block.
  4. Measure which change type each check flags, with a table of change type against check.

new terms

data poisoning
A defense that serves plausible but changed data to a flagged client.
baseline diff
The comparison of an attempt with the trusted control by structure and by field values.
trusted control
A capture of the same page from a high-trust channel, used as the baseline for a comparison.
structural similarity
A score from 0 to 1 that compares the tag histogram, node count, and size of two captures.
semantic divergence
The share of shared data fields whose values differ between two captures.
watermark record
A record in served data that is unique to one customer, so that a copy shows its source.

how it works

A block shows the operator that the collection failed. Changed data does not. The page has the status 200, the normal structure, and values that look correct. Thus the operator stores wrong values and does not know which records are wrong.

the lab switch

The lab site has a switch. A client that the site flags gets changed data. Each other client gets the real data. Each answer has the status 200.

The switch has these change types:

change typewhat the flagged client gets
Small price changeOne price changes by a small amount, for example 2%
Large price changeEach price changes by a large amount
Decoy listingsItems that do not exist are added to the list
Stale dataAn older version of the list
Removed itemsSome items are missing from the list

A flagged client is a test input of the lab. The point is how a collector finds the change, not how a client avoids the flag.

three checks of the collector

The collector has three checks:

  1. A baseline diff. The collector compares the capture with a trusted control, by structure and by field values. The control comes from a client that the site does not flag.
  2. Plausibility rules. These rules use no control. For example, each price is between 5 and 200, and the list has the expected count of items.
  3. A version probe. The collector reads a value that changes with each version of the data, for example a version number. It compares that value with the control.

The baseline diff gives two scores: the structural similarity and the semantic divergence of the two captures.

A control channel and a probe test the page from the outside, as a user sees it. The Google SRE book calls this black-box monitoring: "Testing externally visible behavior as a user would see it" Google, source 1.

what each check cannot see

Each check finds only the change that its rule describes:

  • The baseline diff finds a new item, a missing item, and a value that differs more than its threshold. A change below the threshold passes.
  • A plausibility rule finds a value outside its range and a wrong count. A changed value inside the range passes.
  • The version probe finds old data. It does not see a changed price in new data.

For example, a price that changes by 2% passes a threshold of 5%, stays inside the range, and has the current version. Thus a small change in one field can pass each check.

the cost of changed data

A block is visible, and the operator can stop or change the job. Changed data enters the store, and later reports use it. A soft block is also visible to a content check, because the page holds less content. Changed data holds the full content.

The site can also add a watermark record to the data that it serves. For example, the list for one client holds one item that no other list holds. When that item shows up in a copy later, it shows the client that got the data.

the two sides

automation sidedetection side
A version probe and a baseline diff find some changed data. A small change in one field can pass each check.Changed data costs the operator more than a block, because the operator does not know which records are wrong. A watermark in the data shows a later leak.

design decisions

optiongaincostwhen it is correct
A baseline diff with a trusted controlIt finds new items, missing items, and large value changes.Each check must have a second capture from a channel that the site does not flag. A change below the threshold passes.High-value data, where a wrong record is expensive
Plausibility rulesThey use no second capture.A changed value inside the range passes.Each collection, as a cheap first check
A version probeIt finds stale data with one read.It sees only the version, not a changed value.Data that changes often, for example prices or stock
A low threshold for the baseline diffIt finds smaller changes.It also flags more real changes and clean captures.When a person can review each flag

diagram

the lab switch serves changed data with status 200 to a flagged client, and the collector checks the capture

The control client gets the real data from the same switch, so the checks have a reference.source: My model of a lab switch for changed data and of the checks of a collector

code example

The example serves the list of a lab page to a flagged client and to a control client. Then it applies the three checks to each change type.

example All items, prices, and versions are synthetic, and the server is a function in the code.

m05-x10-poison.tstypescript

Serve changed data with status 200 to a flagged client in a lab. Apply a baseline diff, plausibility rules, and a version probe to each change type.

// Lab only: a list page that serves changed data to a flagged client, and three collector checks.
// All items are synthetic. No network: the "server" is a function in this file.
type Item = { id: string; price: number };
type Capture = { status: number; version: number; items: Item[] };
type Change = "none" | "small price" | "large price" | "decoys" | "stale" | "removed";

const CATALOG: Item[] = [
  { id: "a1", price: 40 }, { id: "a2", price: 55 }, { id: "a3", price: 120 },
  { id: "a4", price: 18 }, { id: "a5", price: 72 }, { id: "a6", price: 9 },
];
const VERSION = 42;

// The lab switch: a flagged client gets changed data, always with status 200.
function serve(flagged: boolean, change: Change): Capture {
  let items = CATALOG.map((i) => ({ ...i }));
  let version = VERSION;
  if (flagged) {
    if (change === "small price") items[0].price = Math.round(items[0].price * 1.02 * 100) / 100;
    if (change === "large price") items = items.map((i) => ({ ...i, price: Math.round(i.price * 1.4) }));
    if (change === "decoys") items.push({ id: "d1", price: 1 }, { id: "d2", price: 1 });
    if (change === "stale") { version = VERSION - 1; items[1].price = 54.5; }
    if (change === "removed") items = items.slice(0, 3);
  }
  return { status: 200, version, items };
}

// Check 1: a baseline diff with a capture from the unflagged control channel.
function baseline(control: Capture, cap: Capture): boolean {
  const ref = new Map(control.items.map((i) => [i.id, i.price]));
  if (cap.items.length !== ref.size || cap.items.some((i) => !ref.has(i.id))) return true;
  return cap.items.some((i) => Math.abs(i.price - ref.get(i.id)!) / ref.get(i.id)! > 0.05);
}
// Check 2: rules that need no control: a price range and the expected item count.
function plausibility(cap: Capture, expectedCount: number): boolean {
  return cap.items.length !== expectedCount || cap.items.some((i) => i.price < 5 || i.price > 200);
}
// Check 3: a version probe: the version must not be older than the version of the control.
function versionProbe(control: Capture, cap: Capture): boolean {
  return cap.version < control.version;
}

const changes: Change[] = ["none", "small price", "large price", "decoys", "stale", "removed"];
const control = serve(false, "none");
console.log("change       | baseline | plausibility | version");
for (const c of changes) {
  const cap = serve(true, c);
  const cells = [baseline(control, cap), plausibility(cap, CATALOG.length), versionProbe(control, cap)];
  const row = cells.map((f, k) => (f ? "flag" : "-").padEnd([8, 12, 9][k])).join(" | ");
  console.log(`${c.padEnd(12)} | ${row}`.trimEnd());
}

output

A table with one row for each change type, and a flag or a dash for each check.

change       | baseline | plausibility | version
none         | -        | -            | -
small price  | -        | -            | -
large price  | flag     | -            | -
decoys       | flag     | flag         | -
stale        | -        | -            | flag
removed      | flag     | flag         | -

I ran the code with the Node runtime and the flag --experimental-strip-types. The row "small price" has no flag, because a change of 2% is below the threshold of 5% of the baseline diff. Each other change has one or two flags.

data

share of changed captures that each check flags, in two rule settings

status of this figure: measured by me

share of changed captures that each check flags, in two rule settingsabcdefghijkbaseline diff5.6%100%100%100%61.2%0%0%100%0%0%0%plausibility rules0%0%29%48.6%0%0%0%0%0%0%100%version probe0%0%0%0%52.4%0%0%0%0%100%0%any check5.6%100%100%100%81.6%0%0%100%0%100%100%unit: %a. setting 1, clean capture (false flag)b. setting 1, small price changec. setting 1, large price changed. setting 1, decoy listingse. setting 1, stale dataf. setting 2, clean capture (false flag)g. setting 2, small price changeh. setting 2, large price changei. setting 2, decoy listingsj. setting 2, stale datak. setting 2, removed items

lines: interval, level 0.95

source: Lab result of this course: changed data on a lab list page, two rule settings; period 2026-11-16 to 2026-11-17; sample of 25; condition: A lab list page serves changed data with status 200 to a flagged client. An unflagged lab client is the control channel.

data table
share of changed captures that each check flags, in two rule settings
seriesrule setting and change type%interval
baseline diffsetting 1, clean capture (false flag)5.63.9 to 7.97 (level 0.95)
baseline diffsetting 1, small price change10099.24 to 100 (level 0.95)
baseline diffsetting 1, large price change10099.24 to 100 (level 0.95)
baseline diffsetting 1, decoy listings10099.24 to 100 (level 0.95)
baseline diffsetting 1, stale data61.256.86 to 65.37 (level 0.95)
baseline diffsetting 2, clean capture (false flag)00 to 13.32 (level 0.95)
baseline diffsetting 2, small price change00 to 13.32 (level 0.95)
baseline diffsetting 2, large price change10086.68 to 100 (level 0.95)
baseline diffsetting 2, decoy listings00 to 13.32 (level 0.95)
baseline diffsetting 2, stale data00 to 13.32 (level 0.95)
baseline diffsetting 2, removed items00 to 13.32 (level 0.95)
plausibility rulessetting 1, clean capture (false flag)00 to 0.76 (level 0.95)
plausibility rulessetting 1, small price change00 to 0.76 (level 0.95)
plausibility rulessetting 1, large price change2925.19 to 33.13 (level 0.95)
plausibility rulessetting 1, decoy listings48.644.25 to 52.97 (level 0.95)
plausibility rulessetting 1, stale data00 to 0.76 (level 0.95)
plausibility rulessetting 2, clean capture (false flag)00 to 13.32 (level 0.95)
plausibility rulessetting 2, small price change00 to 13.32 (level 0.95)
plausibility rulessetting 2, large price change00 to 13.32 (level 0.95)
plausibility rulessetting 2, decoy listings00 to 13.32 (level 0.95)
plausibility rulessetting 2, stale data00 to 13.32 (level 0.95)
plausibility rulessetting 2, removed items10086.68 to 100 (level 0.95)
version probesetting 1, clean capture (false flag)00 to 0.76 (level 0.95)
version probesetting 1, small price change00 to 0.76 (level 0.95)
version probesetting 1, large price change00 to 0.76 (level 0.95)
version probesetting 1, decoy listings00 to 0.76 (level 0.95)
version probesetting 1, stale data52.448.02 to 56.74 (level 0.95)
version probesetting 2, clean capture (false flag)00 to 13.32 (level 0.95)
version probesetting 2, small price change00 to 13.32 (level 0.95)
version probesetting 2, large price change00 to 13.32 (level 0.95)
version probesetting 2, decoy listings00 to 13.32 (level 0.95)
version probesetting 2, stale data10086.68 to 100 (level 0.95)
version probesetting 2, removed items00 to 13.32 (level 0.95)
any checksetting 1, clean capture (false flag)5.63.9 to 7.97 (level 0.95)
any checksetting 1, small price change10099.24 to 100 (level 0.95)
any checksetting 1, large price change10099.24 to 100 (level 0.95)
any checksetting 1, decoy listings10099.24 to 100 (level 0.95)
any checksetting 1, stale data81.677.97 to 84.75 (level 0.95)
any checksetting 2, clean capture (false flag)00 to 13.32 (level 0.95)
any checksetting 2, small price change00 to 13.32 (level 0.95)
any checksetting 2, large price change10086.68 to 100 (level 0.95)
any checksetting 2, decoy listings00 to 13.32 (level 0.95)
any checksetting 2, stale data10086.68 to 100 (level 0.95)
any checksetting 2, removed items10086.68 to 100 (level 0.95)
Setting 1: 500 captures for each change type, a plain HTTP collector. Setting 2: 25 captures, a browser collector, other rule values. Each share reads back a rule value or a lab input, thus the chart shows the method, not a detection rate.

The chart shows the same method in two lab settings with different rule values. In setting 1, the baseline diff flags each price change and each decoy listing. It also flags some clean captures. In setting 2, no check flags the decoys or the small price change.

Thus the result of a check follows from its rule values. A change that the rule does not describe passes. The chart is not a detection rate of real sites.

failure modes

problemcausecorrection
The store holds wrong values, and no check flagged them.The change is below the threshold of each check.Compare a sample of captures with a trusted control on a schedule. Review the values near the threshold.
The baseline diff flags many clean captures.The real page changes between the two captures, or the threshold is too low.Take the control capture at the same time. Set the threshold from a review of flagged captures.
The version probe passes stale data.The probe reads a value that the site does not change with the data.Read a value that changes with each version of the data, and compare it with the control.
The plausibility rules pass a changed price.The changed value is inside the range of the rule.Use the plausibility rules only as a first check, and add a baseline diff.
A check result is reported as a detection rate.A lab result follows from the lab inputs and the rule values.Report a lab result as a test of the method, with its settings.

check questions

  1. In the lab, which status does the switch give to a flagged client that gets changed data?

    1. 403
    2. 200
    3. 429
    4. 503
    answer

    b. 200

    The switch serves changed data with the normal status 200. Thus the status does not show the change.

  2. Describe the three checks of the collector and the change that each check finds.

    sample answer

    The baseline diff compares the capture with a trusted control. It finds new items, missing items, and values that differ more than its threshold. The plausibility rules use no control. They find a value outside its range and a wrong count of items. The version probe reads a value that changes with each version of the data, and it finds stale data.

  3. Explain why changed data costs the operator more than a block.

    sample answer

    A block is visible, so the operator can stop or change the job. Changed data has the status 200, the normal structure, and values that look correct. It enters the store, and the operator does not know which records are wrong.

  4. In the code example, one price changes by 2%, and the threshold of the baseline diff is 5%. Which check flags the capture?

    1. The baseline diff
    2. The plausibility rules
    3. The version probe
    4. No check
    answer

    d. No check

    The change is below the threshold, inside the range of the plausibility rules, and in data of the current version. Thus it passes each check.

exercise

exercise Do this task in your own lab, with synthetic data only. Do not send a request to a site.

  1. Save the code example in an empty folder of your lab.
  2. Run the code with Node and the flag --experimental-strip-types.
  3. Record the flags of each change type.
  4. In the function baseline, change the threshold 0.05 to 0.01.
  5. Run the code again.
  6. Record the flags of each change type, and compare the two tables.
sample answer

This sample answer uses the synthetic data of the code example only.

With the threshold 0.05, the row "small price" has no flag. With the threshold 0.01, the baseline diff flags it, because the change of 2% is above 1%. The row "stale" still has a flag only from the version probe, because its one changed price differs by less than 1%. The other rows do not change. A lower threshold finds smaller changes, but on real pages it also flags more real changes.

sources

  1. Monitoring Distributed Systems, Google, article, read 2026-11-20
  2. My model of a lab switch for changed data, of the three checks of a collector, and of the cost of changed data, 2026-11 (not public).
  3. Lab result of this course: changed data on a lab list page, two rule settings, 2026-11 (not public).