Chapter 09 of 22 Part II: Networks and Communication

Your Invisible Digital Footprints

Each project below is tailored to a specific algorithm and scientific question from Chapter 09, with concrete inputs, verifiable numerical outputs, boundary cases, and links to the related lab and pioneer.

Project 1 of 3 · v1-c09-p01 Foundational · ~25 min

First-Party vs. Third-Party Cookie Scope Lab

Lab activity: Lab A: A shop remembers a ticket · Related code: block-01.js · Pioneer: View profile

Real-World Problem: HTTP is stateless, yet websites remember shopping carts while cross-site ad trackers follow users across domains.
Scientific Question: What is the technical difference between a first-party session cookie and a third-party tracking cookie?

Objective: Simulate browser cookie jars scoped by origin and observe how embedded third-party assets link visits across two unrelated sites.

Hypothesis to Test: Blocking third-party cookies stops cross-site correlation while keeping first-party cart state working.

Step-by-Step Implementation

  1. Model per-domain cookie storage for two unrelated fictional websites.
  2. Attach a simulated third-party image beacon hosted on tracker.example to both sites.
  3. Inspect the request logs sent to each host with third-party cookies allowed vs. blocked.
  4. Verify first-party features (shopping cart, theme) still function with zero third-party cookies.
Concrete Input: Visit shop.example (sets cart=3) and news.example (both embed tracker.example).
Expected Output: With 3rd-party cookies enabled: tracker.example sees both visits; blocked: shop cart still works, cross-site link broken.

Test Cases: First-party cookie isolated to shop.example; Third-party cookie blocked -> zero cross-site IDs.

Boundary Condition: Expired cookies (Max-Age=0) must be removed immediately from subsequent requests.

Common Mistake to Avoid: Assuming all cookies are tracking cookies (many are essential first-party session or security tokens).

Interpreting Results: Understanding cookie scope lets developers build stateful apps without surveillance.

Show Hint, Extension Challenge & Reflection

Hint: Review the worked example and equation in Chapter 09 before testing the boundary case: Expired cookies (Max-Age=0) must be removed immediately from subsequent requests.

Extension Challenge: Implement SameSite=Lax vs. SameSite=Strict behavior in the simulated browser request dispatcher.

Reflection Question: Why does How Digital Works use localStorage with zero third-party cookies?

Project 2 of 3 · v1-c09-p02 Intermediate · ~25 min

Browser Fingerprint Entropy Calculator

Lab activity: Lab B: Compare fictional clues · Related code: block-02.js · Pioneer: View profile

Real-World Problem: Even with cookies blocked, combining ordinary browser traits can single out one person in a large crowd.
Scientific Question: How many bits of identifying information do seemingly harmless attributes add together?

Objective: Compute Shannon self-information I = log2(1/p) across fictional browser traits and watch the anonymity set shrink.

Hypothesis to Test: Combining 5 independent traits each shared by 1 in 16 users yields 20 bits of entropy (1 in 1,048,576).

Step-by-Step Implementation

  1. Assign fictional prevalence probabilities p_i to 4–6 ordinary browser traits.
  2. Compute bits per trait via -Math.log2(p_i) and sum total entropy.
  3. Estimate matching crowd size N * product(p_i).
  4. Test how standardizing a trait (raising p_i toward 1) restores crowd anonymity.
Concrete Input: Fictional population N = 100,000; traits: timezone (1/24), screen (1/32), language (1/10), fonts (1/64).
Expected Output: Combined entropy = 4.58 + 5.00 + 3.32 + 6.00 = 18.91 bits -> expected matching crowd ≈ 0.2 (likely unique).

Test Cases: p = 0.5 -> 1 bit; p = 0.25 -> 2 bits; four p=1/16 traits -> 16 bits.

Boundary Condition: Correlated traits (e.g., timezone and language) add less than the independent sum.

Common Mistake to Avoid: Adding probabilities instead of multiplying them (or multiplying bits instead of adding bits).

Interpreting Results: Entropy quantifies privacy loss mathematically and explains why privacy browsers standardize default traits.

Show Hint, Extension Challenge & Reflection

Hint: Review the worked example and equation in Chapter 09 before testing the boundary case: Correlated traits (e.g., timezone and language) add less than the independent sum.

Extension Challenge: Measure the difference between independent traits and correlated traits on a fictional 1,000-row dataset.

Reflection Question: What surprises you most about how few ordinary settings can uniquely identify a device?

Project 3 of 3 · v1-c09-p03 Foundational · ~20 min

Data-Minimization Form & Payload Auditor

Lab activity: Lab C: Share only what is needed · Related code: block-03.js · Pioneer: View profile

Real-World Problem: Many apps request birthdates, precise GPS, and contact lists when they only need a nickname or city.
Scientific Question: How does minimizing collected fields reduce both privacy exposure and breach impact?

Objective: Audit a fictional app payload, strip unnecessary personal fields, and enforce a strict schema allowlist.

Hypothesis to Test: Using an explicit field allowlist prevents accidental over-collection even when extra fields are submitted.

Step-by-Step Implementation

  1. List the exact purpose of a fictional school quiz app (displaying local score only).
  2. Write a schema sanitizer that keeps only allowlisted non-personal fields.
  3. Test with extra unexpected PII fields and confirm they are dropped.
  4. Document why client-only storage eliminates server-side breach risk.
Concrete Input: Raw payload with { nickname, score, email, exactLat, exactLon, deviceSerial }.
Expected Output: Minimized payload: { nickname, score } (4 unnecessary PII fields stripped).

Test Cases: Extra PII keys -> stripped; Missing required key -> validation error.

Boundary Condition: Nested objects must also be inspected or rejected rather than blindly copied.

Common Mistake to Avoid: Using a denylist (removing known bad keys) instead of an allowlist (keeping only needed keys).

Interpreting Results: Data you never collect cannot be leaked, sold, or subpoenaed.

Show Hint, Extension Challenge & Reflection

Hint: Review the worked example and equation in Chapter 09 before testing the boundary case: Nested objects must also be inspected or rejected rather than blindly copied.

Extension Challenge: Design a local JSON export/import validator that rejects oversized files (>100 KB) and unknown keys.

Reflection Question: Which permissions on your own phone apps are genuinely needed vs. optional?