[Bug]: Clip pages trust X-Forwarded-Host/Proto from any client

Aberta
#106 0 comentários 0 reações 0 responsáveis Ver no GitHub

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
3/5
Tempo estimado
Meio dia
Facilidade para iniciantes
68/100
Tipo de issue
Bug
Clareza
Claramente especificada
Status de atividade
Ativa
Stack de tecnologia
rust
Domínio
backend, security

Direção de pesquisa

Start at origin() in src/api/clips.rs around line 1620 and see how the built URL feeds og:url, og:image and the <video src>. Then read state.public_url() and the throttle's network.trusted-proxies / network.trusts_proxy check to reuse that trust decision instead of inventing one. Done means a request with X-Forwarded-Host: evil.example yields public-url (or Host) in the page, with a test covering the untrusted and trusted-proxy cases.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

bug

[!NOTE]
This issue was written by Claude (Claude Opus 5.5) from a code review session with @PhrolovaMoe. It was found by reading the code and hasn't been reproduced on a running server.

Version

0.40.0 (feat/desktop, 017a837b)

Area

Clips

What happened?

origin() in the clip page builds URLs from X-Forwarded-Proto and X-Forwarded-Host sent by anyone (src/api/clips.rs:1620). It ignores [network] trusted-proxies, which the throttle respects, and the configured public-url. Those URLs go into the page's og:url, og:image and <video src>.

Steps to reproduce

Request /c/<code> with X-Forwarded-Host: evil.example: the page's video and meta tags point at evil.example.

Expected behavior

Clip pages use public-url when set, and only take forwarded headers from trusted proxies otherwise.

Suggested fix

Use state.public_url() first; fall back to forwarded headers only when the peer passes network.trusts_proxy, then to Host.

Linguagem predominante
TypeScript
Estrelas
4
Forks
1
Merge médio
4h 49min
PRs com merge (30d)
5

Preparar o ambiente

  • Inclui um Dockerfile ou arquivo Docker Compose
  • Sem modelo de pull request
  • Sem guia de contribuição

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de tinystream-dev/tinystream

Todas as issues de tinystream-dev/tinystream

Issues semelhantes

Mais issues de TypeScript

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.