getsentry / getsentry/sentry-java

Capture all repeated `Cookie` and `Set-Cookie` header values

Aberta
#5,982 1 comentário 0 reações 0 responsáveis Ver no GitHub
Feature Java Platform: Java
Linguagem predominante
Kotlin
Estrelas
1.4k
Forks
478
Merge médio
3d 4h
PRs com merge (30d)
72

Descrição

## Problem

The OkHttp, Ktor, and Apollo integrations capture only one `Cookie` or `Set-Cookie` header value when creating request and response contexts. Their current header accessors select a **single value**, so additional cookie fields are omitted from Sentry telemetry.

This is valid HTTP behavior. In particular, HTTP/2 allows clients to split the `Cookie` field into **multiple header fields** for compression. Responses also commonly contain multiple `Set-Cookie` fields.

This is follow-up completeness work from #5811 and supports #5666.

**Check what other SDKs are doing before implementing.**

## Proposed solution

Make cookie extraction list-aware across OkHttp, Ktor, Apollo 3, and Apollo 4:

- Combine repeated request `Cookie` fields with `; ` before applying the effective cookie policy.
- Process each response `Set-Cookie` field independently because each field represents one cookie and its attributes.
- Do not comma-join or comma-split `Set-Cookie` values. A valid `Expires` attribute contains a comma.
- Add shared core helpers or integration-specific adapters that apply the effective cookie policy to every value.
- Preserve valid `Set-Cookie` attributes and fail closed for malformed input.

Preserve the existing absent-Data-Collection compatibility behavior for each integration.

## Acceptance criteria

- OkHttp, Ktor, Apollo 3, and Apollo 4 capture all repeated cookie header values supported by their header APIs.
- Multiple request `Cookie` fields are combined with `; ` and filtered as one cookie string.
- Multiple response `Set-Cookie` fields are filtered independently without comma splitting or joining.
- Built-in sensitive-cookie filtering and configured allow-list, deny-list, and off behavior apply to every cookie value.
- Malformed cookie values never bypass filtering.
- Integration tests cover at least two request `Cookie` fields and two response `Set-Cookie` fields where the underlying header API supports repeated values.

Guia de contribuição

Abrir o guia de contribuição

Direção de pesquisa

Comece inspecionando os caminhos existentes de extração de cookies e acesso a headers nas integrações do OkHttp, Ktor, Apollo 3 e Apollo 4; em seguida, compare como outros SDKs lidam com headers repetidos. Rastreie a política compartilhada de cookies e o comportamento quando Data-Collection está ausente antes de executar os testes de integração. O trabalho estará concluído quando valores repetidos de Cookie e Set-Cookie estiverem cobertos sem um tratamento inseguro de vírgulas, o filtro continuar eficaz e valores malformados falharem de forma segura.

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

Avaliação

Stack de tecnologia
java, kotlin
Domínio
api, security, testing
Tipo de issue
Funcionalidade
Dificuldade
4/5
Tempo estimado
3-5 dias
Status de atividade
Ativa
Clareza
Razoavelmente clara
Facilidade para iniciantes
52/100

Receba novas issues na sua caixa de entrada

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