CORS and websocket origin allowlists match unanchored, so 'https://example.com' also allows 'https://example.com.evil.net'
I maintainer di solito rispondono entro 2 giorni
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 68/100
Direzione di ricerca
Start with auth/cors.go:45 and api/stream/stream.go:183, tracing compileAllowedCORSOrigins and compileAllowedWebSocketOrigins to their AllowOriginFunc and Upgrader.CheckOrigin callers. Run the existing CORS and websocket tests if present, then add coverage showing the configured origin is accepted while a hostname with an appended suffix is rejected in both paths. Done means the chosen behavior is tested and any required configuration documentation or release note is updated.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Both origin allowlists compile config entries with regexp.MustCompile and match with MatchString, which is a substring match unless the operator remembers to anchor:
auth/cors.go:45→compileAllowedCORSOrigins, used byAllowOriginFuncapi/stream/stream.go:183→compileAllowedWebSocketOrigins, used byUpgrader.CheckOrigin
So a natural-looking value matches any hostname that merely contains it:
$ GOTIFY_SERVER_CORS_ALLOWORIGINS='https://gotify.example.com' gotify serve
$ curl -sD- -o/dev/null -H 'Origin: https://gotify.example.com' localhost:8792/version
Access-Control-Allow-Origin: https://gotify.example.com
$ curl -sD- -o/dev/null -H 'Origin: https://gotify.example.com.evil.net' localhost:8792/version
Access-Control-Allow-Origin: https://gotify.example.com.evil.net # <-- allowed
$ curl -sD- -o/dev/null -H 'Origin: http://evil.net' localhost:8792/version
(no ACAO header)
Impact is limited — AllowCredentials is never set, so the cookie is not sent cross-origin, and an attacker still needs a token to read anything — but the allowlist does not mean what an operator reading the env var name would assume, and the same footgun applies to GOTIFY_SERVER_STREAM_ALLOWEDORIGINS on the websocket.
Options, in rough order of preference:
- Anchor automatically: wrap each entry as
^(?:…)$before compiling (breaks any existing config that relies on a trailing.*, so it would need a release note). - Keep the regex but warn at startup when an entry is not anchored.
- Document the anchoring requirement in the config docs, at minimum.
Happy to send a PR for whichever you prefer.
- Lingua principale
- Go
- Stelle
- 16k
- Fork
- 891
- Merge medio
- 2g 11h
- PR unite (30g)
- 6
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di gotify/server
-
a:bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 80/100
gotify/server#1068 · 1 reazione ·
I maintainer di solito rispondono entro 2 giorni
-
Session elevation duration is unbounded, and large values silently overflow to a past timestampForse già presa @piyush295 l’ha presa 13 giorni fa. Apertaa:bug
Difficoltà 3/5 1-2 giorni Idoneità per principianti 78/100
gotify/server#1051 · 2 commenti ·
I maintainer di solito rispondono entro 2 giorni
-
a:bug
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
gotify/server#1047 · 6 commenti ·
I maintainer di solito rispondono entro 2 giorni
-
a:feature
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
I maintainer di solito rispondono entro 2 giorni
-
OIDC: Disallow changing admin permissions for oidc users when OIDC group mapping is configuredApertaa:feature
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
I maintainer di solito rispondono entro 2 giorni
Tutte le issue di gotify/server
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 73/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 75/100
slavakurilyak/awesome-ai-agents#742 ·
I maintainer di solito rispondono entro 1 giorno
-
bug go
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
genkit-ai/genkit#6761 · 1 commento ·
I maintainer di solito rispondono entro 2 giorni
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 87/100
I maintainer di solito rispondono entro 2 giorni