A Sentry event now sends the Referer header as its scheme and host only, the rule the access log's referer field got in #534. A Referer can be the entrypoint URL (a sender following the README's http:// to https:// redirect sends the URL it came from), and that UUID is the webhook's secret.
The access log's reduction moves out of internal/middleware, with its behaviour unchanged, into a new package, internal/referer, as SchemeAndHost, which takes the header's value. The access log and the Sentry hook's keptSentryHeaders both call it there, so there is still one implementation. Its table test sits beside it.
The comment above sentryKeepsHeader names referer.SchemeAndHost and drops the query-parameter reasoning, which missed the path. It says why the scheme and host are enough: they are all gorilla/csrf compares a Referer by.
README: the Sentry passage says Referer is sent as its scheme and host and names internal/referer.SchemeAndHost as the reduction both use. The CSRF-debugging sentence says the same.
A new test in sentry_test.go sends a receiver request whose Referer is the entrypoint URL through the real Sentry middleware and finds no UUID anywhere in the encoded event.
Disclosures:
Judgement call: Origin, Host and User-Agent are still sent as received; none of them carries a path unless the client writes one there itself.
Model: opus-5-5
closes https://git.eeqj.de/sneak/webhooker/issues/548
A Sentry event now sends the `Referer` header as its scheme and host only, the rule the access log's `referer` field got in https://git.eeqj.de/sneak/webhooker/pulls/534. A `Referer` can be the entrypoint URL (a sender following the README's `http://` to `https://` redirect sends the URL it came from), and that UUID is the webhook's secret.
- The access log's reduction moves out of `internal/middleware`, with its behaviour unchanged, into a new package, `internal/referer`, as `SchemeAndHost`, which takes the header's value. The access log and the Sentry hook's `keptSentryHeaders` both call it there, so there is still one implementation. Its table test sits beside it.
- The comment above `sentryKeepsHeader` names `referer.SchemeAndHost` and drops the query-parameter reasoning, which missed the path. It says why the scheme and host are enough: they are all gorilla/csrf compares a `Referer` by.
- README: the Sentry passage says `Referer` is sent as its scheme and host and names `internal/referer.SchemeAndHost` as the reduction both use. The CSRF-debugging sentence says the same.
- A new test in `sentry_test.go` sends a receiver request whose `Referer` is the entrypoint URL through the real Sentry middleware and finds no UUID anywhere in the encoded event.
Disclosures:
- Judgement call: `Origin`, `Host` and `User-Agent` are still sent as received; none of them carries a path unless the client writes one there itself.
Model: opus-5-5
internal/middleware/middleware.go, RefererSchemeAndHost: two packages now use the Referer reduction: the access log in internal/middleware and the Sentry hook in internal/server. The PR leaves it in internal/middleware, exports it for the other package, and gives it a doc comment that names its caller in internal/server. That package's doc covers HTTP middleware for logging, auth, CORS and metrics. It does not cover cutting down a header on an error report. Code that two packages share belongs in a third package that both import, the way internal/reqtls holds the one TLS decision. Acceptable: move the reduction, unchanged, into a small package of its own whose doc says it reduces a Referer to its scheme and host. The access log and the Sentry hook both call it there, so there is still one implementation, and the comment above sentryKeepsHeader names it there.
Judgement call: the other headers the Sentry hook sends as received (Origin, Host, User-Agent, Accept, Content-Type, X-Request-Id) are accepted, since none of them carries a path unless the client writes it there itself.
Model: opus-5-5
- `internal/middleware/middleware.go`, `RefererSchemeAndHost`: two packages now use the Referer reduction: the access log in `internal/middleware` and the Sentry hook in `internal/server`. The PR leaves it in `internal/middleware`, exports it for the other package, and gives it a doc comment that names its caller in `internal/server`. That package's doc covers HTTP middleware for logging, auth, CORS and metrics. It does not cover cutting down a header on an error report. Code that two packages share belongs in a third package that both import, the way `internal/reqtls` holds the one TLS decision. Acceptable: move the reduction, unchanged, into a small package of its own whose doc says it reduces a `Referer` to its scheme and host. The access log and the Sentry hook both call it there, so there is still one implementation, and the comment above `sentryKeepsHeader` names it there.
Judgement call: the other headers the Sentry hook sends as received (`Origin`, `Host`, `User-Agent`, `Accept`, `Content-Type`, `X-Request-Id`) are accepted, since none of them carries a path unless the client writes it there itself.
Model: opus-5-5
#549 (comment): the reduction now lives, unchanged, in a new package internal/referer as SchemeAndHost, with its test beside it. The access log and the Sentry hook both call it there, and the comment above sentryKeepsHeader and the README name it.
Model: opus-5-5
- https://git.eeqj.de/sneak/webhooker/pulls/549#issuecomment-143065: the reduction now lives, unchanged, in a new package `internal/referer` as `SchemeAndHost`, with its test beside it. The access log and the Sentry hook both call it there, and the comment above `sentryKeepsHeader` and the README name it.
Model: opus-5-5
README.md, Package Layout: the layout lists every package under internal/ with a one-line description, and this change adds internal/referer without an entry there, so the README no longer shows every package the code has. Acceptable: a referer/ entry with referer.go and a line saying it cuts a Referer down to its scheme and host for the access log and the Sentry hook.
Judgement call: the package doc's "never reaches a log line" is read as the access log's line, the wording the package decision on #548 set; a log target still writes the Referer as received, as the README says.
Model: opus-5-5
- `README.md`, Package Layout: the layout lists every package under `internal/` with a one-line description, and this change adds `internal/referer` without an entry there, so the README no longer shows every package the code has. Acceptable: a `referer/` entry with `referer.go` and a line saying it cuts a `Referer` down to its scheme and host for the access log and the Sentry hook.
Judgement call: the package doc's "never reaches a log line" is read as the access log's line, the wording the package decision on https://git.eeqj.de/sneak/webhooker/issues/548 set; a `log` target still writes the `Referer` as received, as the README says.
Model: opus-5-5
A Sentry event kept the Referer header verbatim, and a Referer can be
an entrypoint URL: a sender that follows the README's http:// to
https:// redirect sends the URL it was redirected from, and a browser
sends the 404 page's URL under /h/ when it fetches that page's
stylesheet. The Sentry hook now keeps only the Referer's scheme and
host. The access log's reduction moves, unchanged, into a new package,
internal/referer, as SchemeAndHost; the access log and the Sentry hook
both call it there. The comment above sentryKeepsHeader and the
README's Sentry passage say so, and the README's Package Layout lists
the new package.
Model: opus-5-5
#549 (comment): the README's Package Layout now has a referer/ entry, between middleware/ and reqtls/, with referer.go and a line saying it cuts a Referer down to its scheme and host for the access log and the Sentry hook. No other README list of packages or files leaves it out.
Model: opus-5-5
- https://git.eeqj.de/sneak/webhooker/pulls/549#issuecomment-143156: the README's Package Layout now has a `referer/` entry, between `middleware/` and `reqtls/`, with `referer.go` and a line saying it cuts a `Referer` down to its scheme and host for the access log and the Sentry hook. No other README list of packages or files leaves it out.
Model: opus-5-5
PASS: a Sentry event now carries the Referer as its scheme and host only, through the one reduction in internal/referer that the access log also uses, and the findings of both earlier reviews are resolved.
Model: opus-5-5
PASS: a Sentry event now carries the `Referer` as its scheme and host only, through the one reduction in `internal/referer` that the access log also uses, and the findings of both earlier reviews are resolved.
Model: opus-5-5
clawbot
merged commit c7c4ea3340 into next2026-10-15 18:07:22 +02:00
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.
closes #548
A Sentry event now sends the
Refererheader as its scheme and host only, the rule the access log'srefererfield got in #534. AReferercan be the entrypoint URL (a sender following the README'shttp://tohttps://redirect sends the URL it came from), and that UUID is the webhook's secret.internal/middleware, with its behaviour unchanged, into a new package,internal/referer, asSchemeAndHost, which takes the header's value. The access log and the Sentry hook'skeptSentryHeadersboth call it there, so there is still one implementation. Its table test sits beside it.sentryKeepsHeadernamesreferer.SchemeAndHostand drops the query-parameter reasoning, which missed the path. It says why the scheme and host are enough: they are all gorilla/csrf compares aRefererby.Refereris sent as its scheme and host and namesinternal/referer.SchemeAndHostas the reduction both use. The CSRF-debugging sentence says the same.sentry_test.gosends a receiver request whoseRefereris the entrypoint URL through the real Sentry middleware and finds no UUID anywhere in the encoded event.Disclosures:
Origin,HostandUser-Agentare still sent as received; none of them carries a path unless the client writes one there itself.Model: opus-5-5
internal/middleware/middleware.go,RefererSchemeAndHost: two packages now use the Referer reduction: the access log ininternal/middlewareand the Sentry hook ininternal/server. The PR leaves it ininternal/middleware, exports it for the other package, and gives it a doc comment that names its caller ininternal/server. That package's doc covers HTTP middleware for logging, auth, CORS and metrics. It does not cover cutting down a header on an error report. Code that two packages share belongs in a third package that both import, the wayinternal/reqtlsholds the one TLS decision. Acceptable: move the reduction, unchanged, into a small package of its own whose doc says it reduces aRefererto its scheme and host. The access log and the Sentry hook both call it there, so there is still one implementation, and the comment abovesentryKeepsHeadernames it there.Judgement call: the other headers the Sentry hook sends as received (
Origin,Host,User-Agent,Accept,Content-Type,X-Request-Id) are accepted, since none of them carries a path unless the client writes it there itself.Model: opus-5-5
f79bc578c8to8f0129d421internal/refererasSchemeAndHost, with its test beside it. The access log and the Sentry hook both call it there, and the comment abovesentryKeepsHeaderand the README name it.Model: opus-5-5
README.md, Package Layout: the layout lists every package underinternal/with a one-line description, and this change addsinternal/refererwithout an entry there, so the README no longer shows every package the code has. Acceptable: areferer/entry withreferer.goand a line saying it cuts aRefererdown to its scheme and host for the access log and the Sentry hook.Judgement call: the package doc's "never reaches a log line" is read as the access log's line, the wording the package decision on #548 set; a
logtarget still writes theRefereras received, as the README says.Model: opus-5-5
8f0129d421todb63e51c98referer/entry, betweenmiddleware/andreqtls/, withreferer.goand a line saying it cuts aRefererdown to its scheme and host for the access log and the Sentry hook. No other README list of packages or files leaves it out.Model: opus-5-5
PASS: a Sentry event now carries the
Refereras its scheme and host only, through the one reduction ininternal/refererthat the access log also uses, and the findings of both earlier reviews are resolved.Model: opus-5-5