Files
Heimdall/skills/sentry-telemetry-privacy/SKILL.md
T
arnaud.dartois 0e6371483d
Heimdall Gitea / Detect CI scope (push) Successful in 5s
Heimdall Gitea / Build and tests (push) Successful in 18m7s
Heimdall Gitea / Build and scan agent image (push) Skipped
Heimdall Gitea / Build and scan NVIDIA Agent image (push) Skipped
Heimdall Gitea / Build and scan server image (push) Successful in 5m6s
Heimdall Gitea / Publish versioned installer release (push) Skipped
Heimdall Gitea / CI policy (push) Successful in 2s
security: redact authentication data from Sentry events (#412)
## Problème et résultat
Les callbacks Sentry Web `SetBeforeSend` et `SetBeforeSendTransaction` expurgent les données sensibles des requêtes et réponses, y compris `Env` et `Other`, contextes, extras, breadcrumbs, tags et spans. Les cartes structurées sont filtrées récursivement; tableaux, collections et objets opaques sont supprimés au lieu d’être sérialisés sans inspection.

Refs #411

## Vérification
- `dotnet test tests/Heimdall.Web.Tests/Heimdall.Web.Tests.csproj --filter FullyQualifiedName~SentryTelemetryPrivacyTests --no-restore --verbosity minimal` : 4/4 réussis.
- `skills/sentry-telemetry-privacy/acceptance.sh` : 4/4 réussis dans le projet Compose jetable `heimdall-sentry-privacy-20261113131621-cad401a7ee`, restore verrouillé; conteneurs, volumes et réseau vérifiés absents. Aucune image locale construite; image SDK amont conservée.
- `bash -n skills/sentry-telemetry-privacy/acceptance.sh` et `git diff --check` réussis.
- Tests uniquement avec sentinelles synthétiques. Aucun événement n’a été envoyé à GlitchTip, aucun credential externe n’a été modifié; provenance/rotation de l’ancienne valeur reste une action opérateur suivie dans #411.

## Livraison

- Le skill couvre maintenant les requêtes `Env`/`Other`, les tags d’événements et les structures imbriquées opaques.

### Release assessment
**Release required; proposed version 1.0.8 (PATCH).** Correction de sécurité rétrocompatible qui doit être reçue par les opérateurs. Base stable locale actuelle : 1.0.7; recalculer après merge si `main` ou les tags ont évolué. Aucun tag n’est créé avant merge et succès des contrôles.

Reviewed-on: #412
Co-authored-by: Arnaud Dartois <admin@tordais.cc>
2026-11-13 15:23:45 +01:00

3.1 KiB

name, description
name description
sentry-telemetry-privacy Keep Heimdall Sentry events free of authentication material while preserving safe diagnostic metadata.

Sentry telemetry privacy

Sentry event and transaction processing are configured in src/Heimdall.Web/Program.cs. SetBeforeSend and SetBeforeSendTransaction are separate SDK callbacks, so apply SentryTelemetryPrivacy to both. Before either payload is sent, filter request Headers, Env, and Other maps; remove request/response cookies, query strings, and bodies; strip URL user information; and filter sensitive values in event extras, transaction contexts, tags, spans, and breadcrumbs. Keep the helper in the Web boundary; do not move request telemetry into Domain or Application.

When changing this behavior:

  • Add focused tests under tests/Heimdall.Web.Tests/Security/ using synthetic SENTINEL_ values only. Serialize final events and transactions through the Sentry SDK serializers and assert no sentinel survives. Also assert safe diagnostic metadata remains.
  • Treat header names case-insensitively and normalize common separators before matching names that indicate authorization, API keys, tokens, secrets, passwords, credentials, or cookies.
  • Clear entire fields such as cookie strings, query strings, and request bodies when selective redaction could miss nested or encoded credentials. Strip URL user information, query, and fragment while retaining the safe path.
  • Apply the same sensitive-key filtering to event extras and breadcrumbs. Preserve the existing rate-limit breadcrumb filter.
  • Recursively inspect string-keyed maps in extras and custom contexts. Replace arrays, other collections, and opaque object graphs with [Filtered] instead of allowing uninspected JSON serialization; retain safe primitive values and safe map entries.
  • Filter sensitive-name tags on both SentryEvent and SentryTransaction; sanitize trace custom data, response headers, and span data/tags.
  • Include synthetic request env/other, sensitive event tags, nested maps, arrays, and opaque values in serializer-level tests.
  • Never copy actual event headers, API keys, cookies, tokens, or request bodies into issue comments, test fixtures, logs, or acceptance evidence. Record only field names and synthetic test outcomes.

Acceptance

Run skills/sentry-telemetry-privacy/acceptance.sh. The recipe runs the focused .NET test from the current checkout in a uniquely named disposable Compose project using the upstream .NET SDK image. It publishes no ports, creates no application image, uses no deployed configuration, and removes and verifies the project's containers, volumes, and network. Its EXIT trap disables inherited errexit/nounset while attempting each independent cleanup step, preserves the original test status, and reports cleanup failures. Upstream SDK images remain cached. Record the project name, test result, local images built: none, and resource-cleanup verification in the linked Gitea issue/PR.

This proves local sanitization logic and event/transaction payload handling only. It does not claim a live Sentry/GlitchTip delivery or rotate any external credential.