Skip to content

Commit 1ccade4

Browse files
committed
update README, add CITATION and papers
1 parent a167c1a commit 1ccade4

File tree

5 files changed

+114
-8
lines changed

5 files changed

+114
-8
lines changed

CITATION.cff

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ abstract: "Reflex emulates real HTTPS referrers locally by serving a trusted red
55
type: software
66
repository-code: https://github.com/samfrm/reflex
77
license: MIT
8+
doi: 10.5281/zenodo.17079395
89
authors:
910
- given-names: "Sam (Abbas)"
1011
family-names: "Farahmand Pashaki"
@@ -17,4 +18,4 @@ preferred-citation:
1718
family-names: "Farahmand Pashaki"
1819
orcid: "https://orcid.org/0009-0006-7721-2644"
1920
url: https://github.com/samfrm/reflex
20-
notes: "version/DOI will be available."
21+
doi: 10.5281/zenodo.17079395

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
[![Release](https://img.shields.io/github/v/release/samfrm/reflex?sort=semver)](https://github.com/samfrm/reflex/releases/latest)
44
[![Downloads](https://img.shields.io/github/downloads/samfrm/reflex/total.svg)](https://github.com/samfrm/reflex/releases)
5+
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.17079395.svg)](https://doi.org/10.5281/zenodo.17079395)
56

67
Emulate real inbound referrers in modern browsers — safely and repeatably.
78

@@ -60,6 +61,12 @@ Reflex opens your default browser (as your normal user) in a private window and
6061
### 📦 Install / Download
6162

6263
- Download: https://github.com/samfrm/reflex/releases/latest
64+
- Go install (Go 1.21+):
65+
66+
```
67+
go install github.com/samfrm/reflex/cmd/reflex@latest
68+
```
69+
6370
- One‑liner (Linux/macOS):
6471

6572
```bash

cmd/reflex/main.go

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const (
2727
)
2828

2929
func main() {
30-
log.SetFlags(0)
30+
log.SetFlags(0)
3131

3232
if len(os.Args) < 2 {
3333
usageAndExit(2)
@@ -65,14 +65,16 @@ func main() {
6565
}
6666
case "help", "-h", "--help":
6767
usageAndExit(0)
68-
case "version", "-v", "--version":
69-
fmt.Println("reflex v0.1.0")
70-
default:
71-
fmt.Fprintf(os.Stderr, "unknown command: %s\n", cmd)
72-
usageAndExit(2)
73-
}
68+
case "version", "-v", "--version":
69+
fmt.Printf("reflex %s\n", version)
70+
default:
71+
fmt.Fprintf(os.Stderr, "unknown command: %s\n", cmd)
72+
usageAndExit(2)
73+
}
7474
}
7575

76+
var version = "dev"
77+
7678
func usageAndExit(code int) {
7779
fmt.Fprintf(os.Stderr, `
7880
reflex — Local HTTPS referrer emulation for analytics testing

paper.bib

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
@misc{mkcert,
2+
title = {mkcert: A simple zero-config tool to make locally-trusted development certificates},
3+
howpublished = {GitHub repository},
4+
author = {{FiloSottile}},
5+
year = {2018},
6+
url = {https://github.com/FiloSottile/mkcert}
7+
}
8+
9+
@misc{w3c-referrer-policy,
10+
title = {Referrer Policy},
11+
author = {{W3C Web Application Security Working Group}},
12+
year = {2023},
13+
howpublished = {W3C Recommendation},
14+
url = {https://www.w3.org/TR/referrer-policy/}
15+
}
16+
17+
@misc{rfc9110,
18+
title = {HTTP Semantics},
19+
author = {Fielding, Roy T. and Nottingham, Mark},
20+
howpublished = {RFC 9110},
21+
year = {2022},
22+
doi = {10.17487/RFC9110},
23+
url = {https://www.rfc-editor.org/rfc/rfc9110}
24+
}
25+

paper.md

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
---
2+
title: "Reflex: Local HTTPS referrer emulation for reproducible web analytics and experimentation"
3+
tags:
4+
- Go
5+
- CLI
6+
- Web
7+
- Measurement
8+
- Analytics
9+
- Referrer
10+
authors:
11+
- name: "Sam (Abbas) Farahmand Pashaki"
12+
orcid: "0009-0006-7721-2644"
13+
affiliation: 1
14+
affiliations:
15+
- name: "Verlag Der Tagesspiegel"
16+
index: 1
17+
date: 2025-09-08
18+
bibliography: paper.bib
19+
---
20+
21+
# Summary
22+
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+
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+
27+
# Statement of need
28+
29+
Researchers and engineers working on measurement, analytics, and experimentation frequently need to validate that instrumentation and targeting work under specific referrer conditions (e.g., partner/campaign origins, paywall previews). In practice, local environments rarely produce the same referrer behavior as production, leading to brittle tests and late discovery of issues (e.g., "Direct/None" sessions, targeting rules that never fire).
30+
31+
Reflex closes this gap by providing a minimal, reproducible workflow to preview an application under a specific referrer, with explicit control over redirect method and `Referrer-Policy`. This enables:
32+
33+
- Pre‑deployment validation of analytics/attribution flows with realistic referrers.
34+
- Reproducible QA of referrer‑sensitive behavior for A/B targeting and paywall gating.
35+
- Repeatable experiments comparing `meta`, `js`, and `302` redirects across browsers.
36+
37+
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.
38+
39+
# Functionality
40+
41+
Reflex provides a single binary with three subcommands:
42+
43+
- `reflex run`: Set up the hosts mapping, generate a local TLS certificate, start a minimal HTTPS server, and open a browser (optionally in private/incognito mode) to perform the redirect.
44+
- `reflex status`: Report whether a reflex‑managed hosts entry, certificate pair, and lock file are present for a given referrer.
45+
- `reflex cleanup`: Remove reflex‑managed hosts entries and temporary certificates safely.
46+
47+
Key implementation details:
48+
49+
- TLS certificates are generated via mkcert to achieve local trust without custom configuration [@mkcert]. On Linux, Reflex supports a shared `CAROOT` so elevated and non‑elevated processes share the same local CA store.
50+
- Redirect methods include HTML `meta` refresh (default), JavaScript `window.location`, and HTTP `302 Found`, enabling cross‑method comparison of referrer behavior [@rfc9110]. The served page can set `Referrer-Policy` headers according to the W3C specification [@w3c-referrer-policy].
51+
- Hosts file edits are tagged (`# reflex-managed`) and backed up for safe cleanup.
52+
- A simple file lock avoids concurrent runs from clobbering hosts entries.
53+
- 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.
54+
55+
# Quality control
56+
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.
58+
59+
# State of the field
60+
61+
Developers commonly rely on ad‑hoc local servers, browser extensions, or general‑purpose proxies to test web behavior. While these tools are powerful, they do not specifically target reproducible referrer emulation with standards‑compliant HTTPS and `Referrer-Policy` control. Reflex fills this narrow but frequently encountered gap with a single‑purpose, scriptable CLI tailored to referrer‑dependent analytics and experimentation.
62+
63+
# Availability
64+
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.17079395).
66+
67+
# Acknowledgements
68+
69+
We thank the maintainers of mkcert and the W3C Web Application Security Working Group for the specifications and tooling that make safe local HTTPS possible.
70+
71+
# References

0 commit comments

Comments
 (0)