Chapter 09 of 22Part 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-p01Foundational · ~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
Model per-domain cookie storage for two unrelated fictional websites.
Attach a simulated third-party image beacon hosted on tracker.example to both sites.
Inspect the request logs sent to each host with third-party cookies allowed vs. blocked.
Verify first-party features (shopping cart, theme) still function with zero third-party cookies.
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?
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?
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?