Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/sentry/integrations/vercel/integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ def build(self) -> dict[str, VercelEnvVarDefinition]:
],
},
"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.

"value": self._auth_token,
"target": ["production", "preview"],
},
Expand Down
8 changes: 4 additions & 4 deletions tests/sentry/integrations/vercel/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ def test_update_organization_config(self) -> None:
],
},
"SENTRY_AUTH_TOKEN": {
"type": "encrypted",
"type": "sensitive",
"value": sentry_auth_token,
"target": ["production", "preview"],
},
Expand Down Expand Up @@ -254,7 +254,7 @@ def test_update_organization_config(self) -> None:
req_params = orjson.loads(responses.calls[8].request.body)
assert req_params["key"] == "SENTRY_AUTH_TOKEN"
assert req_params["target"] == ["production", "preview"]
assert req_params["type"] == "encrypted"
assert req_params["type"] == "sensitive"

req_params = orjson.loads(responses.calls[9].request.body)
assert req_params["key"] == "VERCEL_GIT_COMMIT_SHA"
Expand Down Expand Up @@ -318,7 +318,7 @@ def test_update_org_config_vars_exist(self) -> None:
],
},
"SENTRY_AUTH_TOKEN": {
"type": "encrypted",
"type": "sensitive",
"value": sentry_auth_token,
"target": ["production", "preview"],
},
Expand Down Expand Up @@ -414,7 +414,7 @@ def test_update_org_config_vars_exist(self) -> None:
req_params = orjson.loads(responses.calls[14].request.body)
assert req_params["key"] == "SENTRY_AUTH_TOKEN"
assert req_params["target"] == ["production", "preview"]
assert req_params["type"] == "encrypted"
assert req_params["type"] == "sensitive"

req_params = orjson.loads(responses.calls[17].request.body)
assert req_params["key"] == "VERCEL_GIT_COMMIT_SHA"
Expand Down
Loading