Skip to content

fix(api): Validate request body type for plugin config PUT#115974

Draft
sentry[bot] wants to merge 1 commit into
masterfrom
seer/fix-api-plugin-put-body-validation
Draft

fix(api): Validate request body type for plugin config PUT#115974
sentry[bot] wants to merge 1 commit into
masterfrom
seer/fix-api-plugin-put-body-validation

Conversation

@sentry
Copy link
Copy Markdown
Contributor

@sentry sentry Bot commented May 21, 2026

This PR addresses an AttributeError: 'list' object has no attribute 'get' occurring in the PUT /api/0/projects/{organization_id_or_slug}/{project_id_or_slug}/plugins/{plugin_id}/ endpoint.

The root cause was that the endpoint's put method in project_plugin_details.py expected request.data to be a dictionary when calling request.data.get(key). However, some clients were sending the request body as a JSON array (e.g., [{"name": "urls", "value": "..."}]), which Django REST Framework deserializes into a Python list.

To fix this, a type check has been added at the beginning of the put method. If request.data is not a dictionary, the endpoint now returns a 400 Bad Request response with a clear error message, preventing the AttributeError and providing better feedback to the client.

A corresponding test case has also been added to test_project_plugin_details.py to ensure this validation works as expected.

Legal Boilerplate

Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. and is gonna need some rights from me in order to utilize my contributions in this here PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.

Fixes SENTRY-5M56

@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label May 21, 2026
@mrduncan mrduncan self-assigned this May 21, 2026
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