WEBHOOKER_ENVIRONMENT defaults to dev, silently shipping insecure prod (no Secure cookies, CORS *) #307

Closed
opened 2026-08-30 03:57:23 +02:00 by clawbot · 2 comments
Collaborator

From audit #303 (significant).

Default is dev (internal/config/config.go:139-142), which disables the Secure cookie flag (internal/session/session.go:114) and enables Access-Control-Allow-Origin: * (internal/middleware/middleware.go:143). An operator who forgets the variable runs insecure in prod.

Done: default is prod; dev behavior requires explicitly setting WEBHOOKER_ENVIRONMENT=dev; docs updated.

From audit #303 (significant). Default is `dev` (`internal/config/config.go:139-142`), which disables the `Secure` cookie flag (`internal/session/session.go:114`) and enables `Access-Control-Allow-Origin: *` (`internal/middleware/middleware.go:143`). An operator who forgets the variable runs insecure in prod. Done: default is prod; dev behavior requires explicitly setting `WEBHOOKER_ENVIRONMENT=dev`; docs updated.
Author
Collaborator

Scope narrowed after checking the current tree (#311). The session cookie's Secure flag no longer depends on the environment: it is decided per request from the transport since #269. The only remaining thing dev changes is the CORS middleware (internal/middleware/middleware.go, CORS()), which sends Access-Control-Allow-Origin: * on every route, authenticated pages included, in the default environment.

Definition of done, restated: WEBHOOKER_ENVIRONMENT defaults to prod; dev must be set explicitly; the README configuration table and the resolveEnvironment comment say so; make dev in the README Quick Start keeps working without the variable (nothing in the UI needs CORS). Tests cover the default and the explicit dev.

Model: fable-5-1

Scope narrowed after checking the current tree (https://git.eeqj.de/sneak/webhooker/issues/311). The session cookie's Secure flag no longer depends on the environment: it is decided per request from the transport since https://git.eeqj.de/sneak/webhooker/issues/269. The only remaining thing `dev` changes is the CORS middleware (`internal/middleware/middleware.go`, `CORS()`), which sends `Access-Control-Allow-Origin: *` on every route, authenticated pages included, in the default environment. Definition of done, restated: `WEBHOOKER_ENVIRONMENT` defaults to `prod`; `dev` must be set explicitly; the README configuration table and the `resolveEnvironment` comment say so; `make dev` in the README Quick Start keeps working without the variable (nothing in the UI needs CORS). Tests cover the default and the explicit `dev`. Model: fable-5-1
clawbot added this to the 1.0.0 milestone 2026-09-21 09:20:32 +02:00
Author
Collaborator

Implemented in #322 (base next). WEBHOOKER_ENVIRONMENT now defaults to prod; dev must be set explicitly. The only behaviour this changes is the CORS middleware, which no longer answers every origin with Access-Control-Allow-Origin: * unless dev is set. The README configuration table and prose and the resolveEnvironment comment record the new default, and make dev in the Quick Start still works without the variable. Tests cover the default and the explicit dev. The TRUSTED_PROXIES startup warning is unaffected: it fires in every environment when the list is empty and never depended on the setting.

Model: opus-4-8

Implemented in https://git.eeqj.de/sneak/webhooker/pulls/322 (base `next`). `WEBHOOKER_ENVIRONMENT` now defaults to `prod`; `dev` must be set explicitly. The only behaviour this changes is the CORS middleware, which no longer answers every origin with `Access-Control-Allow-Origin: *` unless `dev` is set. The README configuration table and prose and the `resolveEnvironment` comment record the new default, and `make dev` in the Quick Start still works without the variable. Tests cover the default and the explicit `dev`. The `TRUSTED_PROXIES` startup warning is unaffected: it fires in every environment when the list is empty and never depended on the setting. Model: opus-4-8
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/webhooker#307