/v1/ws accepts an upgrade from any origin. Verified 2026-09-22: a handshake carrying Origin: https://evil.example got 101 Switching Protocols. CORS does not apply to WebSockets, and crates/blackbeard-api/src/ws.rs never reads Origin. So any third-party page could embed the live feed from its visitors' browsers, and the REST allowlist (allowed_origins) does nothing about it.
Before #24 we could not tell whether that happens. Browsers send no Referer on the upgrade handshake, so all 7,551 /v1/ws requests between 2026-09-12 and 2026-09-22 had none, and ours looked the same as anyone else's. Since #24 (6d8c3fe, live 2026-09-22 12:04 UTC) the public vhost logs origin as JSON to /var/log/nginx/blackbeard.observer.access.log on oolon.
The rotated files are gzipped (delaycompress, daily), so use zcat -f over access.log-* for anything older than a day.
Expected:
https://blackbeard.observer: our UI.
empty: non-browser clients (scripts, bots, wallet backends). An Origin check would not affect them, because a non-browser client can send any Origin it likes.
http://localhost:*: dev servers.
Anything else is a third-party page opening our socket from its visitors' browsers.
The decision
Only our origin, plus empty or localhost: nothing is embedding us. An Origin check is cheap hardening but not urgent. Decide whether to add it anyway and record why.
Other origins present: identify them before blocking. A wallet or explorer we would want to support is a case for adding it to allowed_origins, not for refusing it. Then enforce Origin in the WS handler: reject a present Origin not in allowed_origins, and allow an absent one (non-browser clients). Do it in axum rather than nginx, so the allowlist stays in one place.
Record the numbers here either way. The outcome is a documented decision, not necessarily a code change.
Also note any "denied":1 lines with browser User-Agents. That is #24's deny list catching VPN users, and a reason to revisit it.
## Why
`/v1/ws` accepts an upgrade from any origin. Verified 2026-09-22: a handshake carrying `Origin: https://evil.example` got `101 Switching Protocols`. CORS does not apply to WebSockets, and `crates/blackbeard-api/src/ws.rs` never reads `Origin`. So any third-party page could embed the live feed from its visitors' browsers, and the REST allowlist (`allowed_origins`) does nothing about it.
Before #24 we could not tell whether that happens. Browsers send no Referer on the upgrade handshake, so all 7,551 `/v1/ws` requests between 2026-09-12 and 2026-09-22 had none, and ours looked the same as anyone else's. Since #24 (`6d8c3fe`, live 2026-09-22 12:04 UTC) the public vhost logs `origin` as JSON to `/var/log/nginx/blackbeard.observer.access.log` on oolon.
## To do, after 2026-09-29
Break the WebSocket upgrades down by origin:
```sh
ssh oolon.kosherinata.internal 'sudo cat /var/log/nginx/blackbeard.observer.access.log*' \
| jq -r 'select(.uri | startswith("/v1/ws")) | select(.denied==0) | .origin' \
| sort | uniq -c | sort -rn
```
The rotated files are gzipped (`delaycompress`, daily), so use `zcat -f` over `access.log-*` for anything older than a day.
Expected:
- `https://blackbeard.observer`: our UI.
- empty: non-browser clients (scripts, bots, wallet backends). An Origin check would not affect them, because a non-browser client can send any Origin it likes.
- `http://localhost:*`: dev servers.
Anything else is a third-party page opening our socket from its visitors' browsers.
## The decision
- **Only our origin, plus empty or localhost:** nothing is embedding us. An Origin check is cheap hardening but not urgent. Decide whether to add it anyway and record why.
- **Other origins present:** identify them before blocking. A wallet or explorer we would want to support is a case for adding it to `allowed_origins`, not for refusing it. Then enforce Origin in the WS handler: reject a *present* Origin not in `allowed_origins`, and allow an absent one (non-browser clients). Do it in axum rather than nginx, so the allowlist stays in one place.
Record the numbers here either way. The outcome is a documented decision, not necessarily a code change.
Also note any `"denied":1` lines with browser User-Agents. That is #24's deny list catching VPN users, and a reason to revisit it.
Related: #24.
Scheduled: a systemd user timer on grenade's workstation (bb-origin-report.timer, 2026-09-29 09:00 Europe/Sofia, Persistent=true) runs ~/.local/bin/bb-origin-report. The script reads the #24 JSON log over ssh and posts the numbers here as a comment: WebSocket upgrades by Origin, REST by Origin, and denials with browser User-Agents. It posts numbers only. The decision stays with a human.
It is not a cloud routine because a cloud agent can reach neither oolon nor this Gitea.
Scheduled: a systemd user timer on grenade's workstation (`bb-origin-report.timer`, 2026-09-29 09:00 Europe/Sofia, `Persistent=true`) runs `~/.local/bin/bb-origin-report`. The script reads the #24 JSON log over ssh and posts the numbers here as a comment: WebSocket upgrades by Origin, REST by Origin, and denials with browser User-Agents. It posts numbers only. The decision stays with a human.
It is not a cloud routine because a cloud agent can reach neither oolon nor this Gitea.
Automated report for this issue, from /var/log/nginx/blackbeard.observer.access.log* on oolon (the #24 JSON log). It gives the numbers only. The decision is still open.
Read against the issue: https://blackbeard.observer is our UI, (none) is non-browser clients that an Origin check would not affect, and localhost is dev. Anything else is a third-party page.
Decision, 2026-10-07: closing without an Origin check.
From the 2026-09-29 report, covering a week of the #24 log: 1,843 WebSocket upgrades from https://blackbeard.observer (92 IPs) and one with no Origin. No third-party page opened the socket.
An Origin check would therefore stop nothing that happens today. A non-browser client can send any Origin it likes, so the check would only ever affect embedding by another site's visitors, and nobody is doing that. Not adding it keeps one less thing to keep in step with the domains the site serves on.
Reopen if a foreign origin shows up on /v1/ws upgrades. The jq query in the issue body still finds them.
**Decision, 2026-10-07: closing without an Origin check.**
From the 2026-09-29 report, covering a week of the #24 log: 1,843 WebSocket upgrades from `https://blackbeard.observer` (92 IPs) and one with no Origin. **No third-party page opened the socket.**
An Origin check would therefore stop nothing that happens today. A non-browser client can send any Origin it likes, so the check would only ever affect embedding by another site's visitors, and nobody is doing that. Not adding it keeps one less thing to keep in step with the domains the site serves on.
Reopen if a foreign origin shows up on `/v1/ws` upgrades. The `jq` query in the issue body still finds them.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Why
/v1/wsaccepts an upgrade from any origin. Verified 2026-09-22: a handshake carryingOrigin: https://evil.examplegot101 Switching Protocols. CORS does not apply to WebSockets, andcrates/blackbeard-api/src/ws.rsnever readsOrigin. So any third-party page could embed the live feed from its visitors' browsers, and the REST allowlist (allowed_origins) does nothing about it.Before #24 we could not tell whether that happens. Browsers send no Referer on the upgrade handshake, so all 7,551
/v1/wsrequests between 2026-09-12 and 2026-09-22 had none, and ours looked the same as anyone else's. Since #24 (6d8c3fe, live 2026-09-22 12:04 UTC) the public vhost logsoriginas JSON to/var/log/nginx/blackbeard.observer.access.logon oolon.To do, after 2026-09-29
Break the WebSocket upgrades down by origin:
The rotated files are gzipped (
delaycompress, daily), so usezcat -foveraccess.log-*for anything older than a day.Expected:
https://blackbeard.observer: our UI.http://localhost:*: dev servers.Anything else is a third-party page opening our socket from its visitors' browsers.
The decision
allowed_origins, not for refusing it. Then enforce Origin in the WS handler: reject a present Origin not inallowed_origins, and allow an absent one (non-browser clients). Do it in axum rather than nginx, so the allowlist stays in one place.Record the numbers here either way. The outcome is a documented decision, not necessarily a code change.
Also note any
"denied":1lines with browser User-Agents. That is #24's deny list catching VPN users, and a reason to revisit it.Related: #24.
Scheduled: a systemd user timer on grenade's workstation (
bb-origin-report.timer, 2026-09-29 09:00 Europe/Sofia,Persistent=true) runs~/.local/bin/bb-origin-report. The script reads the #24 JSON log over ssh and posts the numbers here as a comment: WebSocket upgrades by Origin, REST by Origin, and denials with browser User-Agents. It posts numbers only. The decision stays with a human.It is not a cloud routine because a cloud agent can reach neither oolon nor this Gitea.
Automated report for this issue, from
/var/log/nginx/blackbeard.observer.access.log*on oolon (the #24 JSON log). It gives the numbers only. The decision is still open.Span: 2026-09-22T12:03:25+00:00 → 2026-09-29T06:00:43+00:00, 23557 requests
/v1/wsupgrades by Origin (not denied)https://blackbeard.observer(none)Read against the issue:
https://blackbeard.observeris our UI,(none)is non-browser clients that an Origin check would not affect, andlocalhostis dev. Anything else is a third-party page.REST
/v1/*by Origin, for comparison(none)https://blackbeard.observerDeny list (#24)
8452 denied requests, 4 with a browser User-Agent.
37.187.143.115135.181.130.74stardust-devops167.233.143.69Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, l5.135.137.201Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, l51.178.179.51Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, l95.217.114.145Mozilla/5.0 (compatible; SERankingBacklinksBot/1.0; +https://serankingBrowser User-Agents among the denials would be VPN users caught by the Hetzner/OVH list.
Posted by
~/.local/bin/bb-origin-reportvia a systemd user timer.Decision, 2026-10-07: closing without an Origin check.
From the 2026-09-29 report, covering a week of the #24 log: 1,843 WebSocket upgrades from
https://blackbeard.observer(92 IPs) and one with no Origin. No third-party page opened the socket.An Origin check would therefore stop nothing that happens today. A non-browser client can send any Origin it likes, so the check would only ever affect embedding by another site's visitors, and nobody is doing that. Not adding it keeps one less thing to keep in step with the domains the site serves on.
Reopen if a foreign origin shows up on
/v1/wsupgrades. Thejqquery in the issue body still finds them.