Skip to content

fix(vercel): use sensitive type for SENTRY_AUTH_TOKEN env var#115700

Open
sentry-junior[bot] wants to merge 1 commit into
masterfrom
jr/vercel-auth-token-sensitive
Open

fix(vercel): use sensitive type for SENTRY_AUTH_TOKEN env var#115700
sentry-junior[bot] wants to merge 1 commit into
masterfrom
jr/vercel-auth-token-sensitive

Conversation

@sentry-junior
Copy link
Copy Markdown
Contributor

@sentry-junior sentry-junior Bot commented May 16, 2026

Summary

Changes the Vercel env var type for SENTRY_AUTH_TOKEN from encrypted to sensitive so the value becomes write-only in Vercel — it cannot be read back through the Vercel API or dashboard after creation.

The Vercel API supports four env var types: system, encrypted, plain, and sensitive. We were using encrypted for all env vars including the auth token. Using sensitive for the auth token reduces blast radius if a Vercel account is compromised.

This applies to new installs and project mapping re-configurations. Existing env vars will be updated to sensitive when project mappings are next saved (the integration's update_organization_config calls create_env_var which falls through to update_env_variable on ENV_ALREADY_EXISTS).

Changes

  • src/sentry/integrations/vercel/integration.py: SENTRY_AUTH_TOKEN type encryptedsensitive in VercelEnvVarMapBuilder.build()
  • tests/sentry/integrations/vercel/test_integration.py: updated env_var_map fixtures and request body assertions in test_update_org_config and test_update_org_config_vars_exist

Refs #113391

Change the Vercel env var type for SENTRY_AUTH_TOKEN from 'encrypted'
to 'sensitive' so the value becomes write-only and cannot be read back
through the Vercel API or dashboard.

The Vercel API supports four env var types: system, encrypted, plain,
and sensitive. Using 'sensitive' ensures the auth token is not exposed
after initial creation, reducing blast radius if a Vercel account is
compromised.

This applies to new installs and re-configurations; existing env vars
will be updated when project mappings are next saved.

Refs: #113391
@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label May 16, 2026
},
"SENTRY_AUTH_TOKEN": {
"type": "encrypted",
"type": "sensitive",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Updating an existing Vercel environment variable's type to sensitive via a PATCH request is an unsupported API operation and will either fail or be silently ignored.
Severity: HIGH

Suggested Fix

To correctly change the environment variable type to sensitive, the variable must be deleted and then recreated. Implement a delete-then-create logic for environment variables when a type change from encrypted to sensitive is detected, instead of using the current PATCH update method. This may require adding a method to delete environment variables in the VercelClient.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.

Location: src/sentry/integrations/vercel/integration.py#L185

Potential issue: The code attempts to update an existing Vercel environment variable's
type from `encrypted` to `sensitive` using a `PATCH` request. According to Vercel's API
documentation, this operation is unsupported. This will either cause the API to return
an error, which will raise a `ValidationError` and break the configuration update
process for existing integrations, or the API will silently ignore the type change. If
ignored, the environment variable will remain `encrypted`, defeating the security goal
of the change for existing installations.

Did we get this right? 👍 / 👎 to inform future reviews.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant