Skip to content

feat(seer): Add signed viewer context header to Seer API requests#109626

Merged
azulus merged 2 commits intomasterfrom
jstanley/seer-viewer-context
Feb 28, 2026
Merged

feat(seer): Add signed viewer context header to Seer API requests#109626
azulus merged 2 commits intomasterfrom
jstanley/seer-viewer-context

Conversation

@azulus
Copy link
Member

@azulus azulus commented Feb 27, 2026

Add an optional viewer_context parameter to make_signed_seer_api_request that allows callers to pass organization_id and/or user_id. When provided, these are serialized as JSON into an X-Viewer-Context header and HMAC-SHA256 signed into a companion X-Viewer-Context-Signature header using the shared Seer secret.

This gives Seer a verified way to know which organization and user originated a request, enabling access control and audit logging on their side. No callers pass this yet — this just adds the plumbing.

Add optional viewer_context parameter to make_signed_seer_api_request
that writes organization_id and user_id as a signed X-Viewer-Context
header. The context is HMAC-SHA256 signed with the shared secret,
allowing Seer to verify the caller's identity for access control.

Co-Authored-By: Claude <noreply@anthropic.com>
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Feb 27, 2026
Match the existing pattern in sign_with_seer_secret by checking that
SEER_API_SHARED_SECRET is set before attempting to sign the viewer
context. Log a warning instead of crashing with AttributeError.

Co-Authored-By: Claude <noreply@anthropic.com>
@azulus azulus marked this pull request as ready for review February 28, 2026 00:22
@azulus azulus requested a review from a team as a code owner February 28, 2026 00:22
@azulus azulus merged commit 690cd30 into master Feb 28, 2026
76 checks passed
@azulus azulus deleted the jstanley/seer-viewer-context branch February 28, 2026 00:43
jan-auer added a commit that referenced this pull request Mar 2, 2026
…ept-encoding

* origin/master: (63 commits)
  fix(api): Add missing cursor query parameter to paginated endpoint OpenAPI schemas (#109642)
  docs(sentry-apps): Add sentryAppId to sentry-app-installations API schema (#109628)
  feat(occurrences on eap): Implement double reads from EAP in organization events trace API endpoint (#109391)
  feat(occurrences on eap): Implement double reads from EAP for reprocessing2 flow (#109345)
  feat(ci): report backend test fails (#109543)
  feat(seer): Add signed viewer context header to Seer API requests (#109626)
  devenv: cleanup devenv-managed uv (#109617)
  feat(seer): Iterate on the instructions at the top of seer settings pages (#109586)
  ref(seer): Add typed wrappers for remaining Seer API callsites (#109607)
  feat(preprod): Make snapshots endpoint org scoped (#109575)
  chore: capture exception (#109620)
  fix(formatting): run ruff format (#109618)
  feat(preprod): Create admin gated recompare snapshots endpoint (#109546)
  feat(cells): expand locality/cell distinction (#109538)
  feat(cells): add db migration for synapse (#109615)
  feat(preprod): Add public install-details endpoint and shared utilities (#109583)
  fix(tests): Fix flaky test_cross_trace_query_with_spans_and_logs (#109572)
  fix(grouping): Resolve mypy possibly-undefined errors in grouphash caching (#109602)
  fix(dashboards): Default axisRange to auto for existing widgets in builder (#109598)
  fix(billing): Fix category display names in pending changes (#109612)
  ...
azulus added a commit that referenced this pull request Mar 2, 2026
…109697)

## Summary
- Propagates the optional `viewer_context: SeerViewerContext | None`
kwarg through all 51 wrapper functions across 15 files that call
`make_signed_seer_api_request()`
- Enables callers to pass organization and user context which gets
HMAC-signed into `X-Viewer-Context` / `X-Viewer-Context-Signature`
headers for Seer access control
- All new params default to `None` — no call sites are changed yet

Builds on #109626 which added `viewer_context` support to
`make_signed_seer_api_request()`.

## Test plan
- All changes are additive (new optional param defaulting to `None`), so
existing behavior is unchanged
- Pre-commit passes on all 15 modified files
- CI should validate no regressions
@github-actions github-actions bot locked and limited conversation to collaborators Mar 15, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants