Skip to content

Commit 356fd7f

Browse files
committed
add more resources and docs
1 parent 2000b0c commit 356fd7f

File tree

4 files changed

+100
-11
lines changed

4 files changed

+100
-11
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ on:
88

99
jobs:
1010
build:
11-
runs-on: ubuntu-latest
11+
strategy:
12+
matrix:
13+
os: [ubuntu-latest, macos-latest, windows-latest]
14+
runs-on: ${{ matrix.os }}
1215
steps:
1316
- uses: actions/checkout@v4
1417
- uses: actions/setup-go@v5
@@ -18,4 +21,3 @@ jobs:
1821
run: go build ./...
1922
- name: Test
2023
run: go test ./...
21-

README.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,31 @@ More:
114114

115115
- ⏱️ `--delay` (meta/js, ms), 🔌 `--port` (default 443, falls back to 8443), 🗂️ `--keep-certs`, 🧪 `--no-hosts`, 🧹 `--force-unlock`
116116

117+
### 🔬 Research examples
118+
119+
- Validate experiment gating locally (referrer → experiment route):
120+
121+
```bash
122+
sudo reflex run \
123+
--referrer https://news.google.com \
124+
--target https://localhost:3000/experiment
125+
```
126+
127+
- Compare redirect methods and observe `document.referrer` differences:
128+
129+
```bash
130+
sudo reflex run --referrer https://news.google.com --target https://localhost:3000 --method meta
131+
sudo reflex run --referrer https://news.google.com --target https://localhost:3000 --method js
132+
sudo reflex run --referrer https://news.google.com --target https://localhost:3000 --method 302
133+
```
134+
135+
- Evaluate `Referrer-Policy` effects (origin vs full URL):
136+
137+
```bash
138+
sudo reflex run --referrer https://news.google.com --target https://localhost:3000 --referrer-policy origin-when-cross-origin
139+
sudo reflex run --referrer https://news.google.com --target https://localhost:3000 --referrer-policy unsafe-url
140+
```
141+
117142
### 🩹 Troubleshooting (fast answers)
118143

119144
- 🥚 Empty `document.referrer`?

paper.bib

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ @misc{mkcert
33
howpublished = {GitHub repository},
44
author = {{FiloSottile}},
55
year = {2018},
6-
url = {https://github.com/FiloSottile/mkcert}
6+
url = {https://github.com/FiloSottile/mkcert},
7+
note = {Accessed 2025-09-16}
78
}
89

910
@misc{w3c-referrer-policy,
@@ -27,19 +28,48 @@ @misc{mitmproxy
2728
title = {mitmproxy: An interactive HTTPS proxy},
2829
howpublished = {Project website},
2930
year = {2025},
30-
url = {https://mitmproxy.org/}
31+
url = {https://mitmproxy.org/},
32+
note = {Accessed 2025-09-16}
3133
}
3234

3335
@misc{selenium,
3436
title = {Selenium WebDriver Project},
3537
howpublished = {Project website},
3638
year = {2025},
37-
url = {https://www.selenium.dev/}
39+
url = {https://www.selenium.dev/},
40+
note = {Accessed 2025-09-16}
3841
}
3942

4043
@misc{playwright,
4144
title = {Playwright},
4245
howpublished = {Project website},
4346
year = {2025},
44-
url = {https://playwright.dev/}
47+
url = {https://playwright.dev/},
48+
note = {Accessed 2025-09-16}
49+
}
50+
51+
@book{kohavi2020trustworthy,
52+
title = {Trustworthy Online Controlled Experiments: A Practical Guide to A/B Testing},
53+
author = {Kohavi, Ron and Tang, Diane and Xu, Ya},
54+
year = {2020},
55+
publisher = {Cambridge University Press},
56+
doi = {10.1017/9781108653985}
57+
}
58+
59+
@inproceedings{englehardt2016online,
60+
title = {Online tracking: A 1-million-site measurement and analysis},
61+
author = {Englehardt, Steven and Narayanan, Arvind},
62+
booktitle = {Proceedings of the 2016 ACM SIGSAC Conference on Computer and Communications Security},
63+
year = {2016},
64+
pages = {1388--1401},
65+
doi = {10.1145/2976749.2978313}
66+
}
67+
68+
@inproceedings{acar2014never,
69+
title = {The Web Never Forgets: Persistent Tracking Mechanisms in the Wild},
70+
author = {Acar, Gunes and Eubank, Christian and Englehardt, Steven and Juarez, Marc and Narayanan, Arvind and Diaz, Claudia},
71+
booktitle = {Proceedings of the 2014 ACM SIGSAC Conference on Computer and Communications Security},
72+
year = {2014},
73+
pages = {674--689},
74+
doi = {10.1145/2660267.2660347}
4575
}

paper.md

Lines changed: 37 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ tags:
77
- Measurement
88
- Analytics
99
- Referrer
10+
- Reproducibility
1011
authors:
1112
- name: "Sam (Abbas) Farahmand Pashaki"
1213
orcid: "0009-0006-7721-2644"
@@ -20,9 +21,9 @@ bibliography: paper.bib
2021

2122
# Summary
2223

23-
Browser referrer behavior is central to analytics, experimentation, and attribution pipelines, but it is difficult to reproduce locally. Browsers often suppress `Referer`/`document.referrer` in common local setups (non‑HTTPS origins, external 302 navigations, or OS/browser trust gaps), which prevents meaningful pre‑deployment validation.
24+
Browser referrer behavior is central to analytics, experimentation, and attribution pipelines, but it is difficult to reproduce locally in a way that is faithful to production and repeatable by other researchers. Browsers often suppress `Referer`/`document.referrer` in common local setups (non‑HTTPS origins, external 302 navigations, or OS/browser trust gaps), which prevents meaningful pre‑deployment validation and undermines the reproducibility of measurement.
2425

25-
Reflex is a small cross‑platform command‑line tool that emulates a realistic referrer locally. It temporarily maps a chosen referrer host to the developer’s machine, serves a trusted HTTPS page with a configurable redirect method, and then navigates to the target application so the browser sets a real `Referer`. Reflex respects the web platform’s referrer policy semantics [@w3c-referrer-policy] and standard HTTP redirection behavior [@rfc9110], and leverages locally trusted certificates via mkcert [@mkcert].
26+
Reflex is a small cross‑platform command‑line tool that emulates a realistic referrer locally. It temporarily maps a chosen referrer host to the developer’s machine, serves a trusted HTTPS page with a configurable redirect method, and then navigates to the target application so the browser sets a real `Referer`. Reflex respects the web platform’s referrer policy semantics [@w3c-referrer-policy] and standard HTTP redirection behavior [@rfc9110], and leverages locally trusted certificates via mkcert [@mkcert]. This enables researchers and engineers to reproduce and share referrer‑dependent scenarios in a single command, improving the validity of analytics and experiment instrumentation.
2627

2728
# Statement of need
2829

@@ -36,6 +37,24 @@ Reflex closes this gap by providing a minimal, reproducible workflow to preview
3637

3738
The tool is intentionally focused: it does not alter browser settings, require extensions, or act as a full proxy. Instead, it uses a short, standards‑compliant HTTPS redirect from a local origin that mimics the selected referrer.
3839

40+
Minimal reproducible example. The following single command reproduces a realistic referrer across OSes using locally trusted HTTPS:
41+
42+
```
43+
reflex run --referrer https://news.google.com --target https://localhost:3000/experiment
44+
```
45+
46+
This opens a private/incognito browser window and performs a standards‑conformant redirect so the target observes a populated Referer (e.g., `https://news.google.com/`). The same invocation can be shared to reproduce the scenario on other machines.
47+
48+
49+
50+
# Use cases for research
51+
52+
- Analytics/attribution validation for controlled experiments: Researchers running online controlled experiments (A/B tests) often need to verify instrumentation and gating rules that depend on referrer context (e.g., arriving from a partner site). Reflex provides a reproducible way to preview and test these flows locally before running or analyzing experiments [@kohavi2020trustworthy].
53+
- Cross‑browser measurement of `Referrer-Policy` and redirect methods: Web measurement studies can compare how browsers populate `Referer`/`document.referrer` under `meta`, `js`, and `302` redirects with different policies. Reflex enables these controlled tests across OSes with locally trusted TLS [@w3c-referrer-policy; @rfc9110].
54+
- Privacy and tracking studies: Prior work shows the prevalence and risks of referrer‑based tracking and leakage on the web [@englehardt2016online; @acar2014never]. Reflex can generate reproducible referrer scenarios to validate mitigations (e.g., policy choices) or to build small‑scale datasets illustrating leakage conditions.
55+
56+
Expected impact. While seemingly narrow, reliable referrer emulation is a recurring prerequisite for trustworthy analytics, A/B testing, and privacy measurement. Reflex lowers the setup cost for these workflows and makes them repeatable across environments, which can reduce instrumentation regressions and improve the integrity of subsequent analyses [@kohavi2020trustworthy].
57+
3958
# Functionality
4059

4160
Reflex provides a single binary with three subcommands:
@@ -52,17 +71,30 @@ Key implementation details:
5271
- A simple file lock avoids concurrent runs from clobbering hosts entries.
5372
- Cross‑platform browser launchers drop elevated privileges where appropriate so the browser opens in the user’s desktop session (Linux/macOS), with optional private/incognito flags.
5473

74+
# Limitations and scope
75+
76+
Reflex is intentionally narrow in scope:
77+
78+
- Not a proxy or MITM: it does not intercept traffic or modify requests beyond serving a short redirect.
79+
- Local emulation only: it is designed for local testing, not production spoofing of referrers.
80+
- No browser reconfiguration: it avoids changing browser settings, profiles, or policies.
81+
- Subject to site controls: site‑specific defenses (e.g., CSP, framebusting) remain in effect.
82+
5583
# Quality control
5684

57-
The repository includes unit tests for the HTTPS redirector (verifying method‑specific behavior and `Referrer-Policy` headers), hosts file management (add/remove, idempotency, bulk cleanup), local locking, and mkcert detection. Continuous Integration builds and runs tests on Linux via GitHub Actions.
85+
The repository includes unit tests for the HTTPS redirector (verifying method‑specific behavior and `Referrer-Policy` headers), hosts file management (add/remove, idempotency, bulk cleanup), local locking, and mkcert detection. Tests generate ephemeral self‑signed certificates (no mkcert required) to isolate server behavior. Continuous Integration builds and runs tests on Linux, macOS, and Windows via GitHub Actions.
5886

5987
# State of the field
6088

61-
Developers commonly rely on ad‑hoc local servers, browser extensions, or general‑purpose proxies (e.g., mitmproxy [@mitmproxy]) to test web behavior. Automation frameworks such as Selenium [@selenium] and Playwright [@playwright] can orchestrate browser flows, but they do not specifically target reproducible referrer emulation with locally trusted HTTPS and precise `Referrer-Policy` control out‑of‑the‑box. Reflex fills this narrow but frequently encountered gap with a single‑purpose, scriptable CLI tailored to referrer‑dependent analytics and experimentation.
89+
Developers commonly rely on ad‑hoc local servers, browser extensions, or general‑purpose proxies (e.g., mitmproxy [@mitmproxy]) to test web behavior. Automation frameworks such as Selenium [@selenium] and Playwright [@playwright] can orchestrate browser flows, but they do not specifically target reproducible referrer emulation with locally trusted HTTPS and precise `Referrer-Policy` control out‑of‑the‑box. Reflex fills this narrow but frequently encountered gap with a single‑purpose, scriptable CLI tailored to referrer‑dependent analytics and experimentation. Unlike browser extensions and flag‑based overrides, it produces a standards‑conformant HTTPS navigation with a trusted certificate and explicit `Referrer‑Policy`, yielding consistent, shareable results across browsers and OSes.
6290

6391
# Availability
6492

65-
Reflex is implemented in Go and distributed as prebuilt binaries for Linux, macOS, and Windows. Source code and issue tracking are available at: https://github.com/samfrm/reflex. An archival release is available on Zenodo (DOI: https://doi.org/10.5281/zenodo.17081049). This paper refers to version v0.1.3 of the software.
93+
Reflex is implemented in Go and distributed as prebuilt binaries for Linux, macOS, and Windows. Source code and issue tracking are available at: https://github.com/samfrm/reflex. Reflex is MIT‑licensed (LICENSE: https://github.com/samfrm/reflex/blob/main/LICENSE) and archived per‑version on Zenodo (DOI: https://doi.org/10.5281/zenodo.17081049). This paper refers to version v0.1.3 of the software.
94+
95+
# History and maturity
96+
97+
Reflex packages a pattern I’ve used for years—local HTTPS, a short redirect, and hosts mapping—into a single CLI. I open‑sourced and packaged it recently, which is why the public commit history is short. Compared to the original scripts, the CLI adds: mkcert‑based local trust with a shared CAROOT on Linux (/etc/mkcert), tagged and backed‑up /etc/hosts edits (“# reflex‑managed”), a file lock to prevent concurrent runs, and a browser launcher that drops privileges to open a private window in the user session. The repository includes tests and CI; server tests assert the `Referrer‑Policy` and redirect bodies/headers for `meta`, `js`, and `302` methods. I’m not aware of citations yet due to the recent release, but Reflex directly supports the reproducible analytics/experimentation and privacy measurement workflows described in this paper.
6698

6799
# Acknowledgements
68100

0 commit comments

Comments
 (0)