Skip to content

feat(investigations): Add response serializers - #121576

Merged
wedamija merged 2 commits into
masterfrom
danf/investigations-serializers
Aug 10, 2026
Merged

feat(investigations): Add response serializers#121576
wedamija merged 2 commits into
masterfrom
danf/investigations-serializers

Conversation

@wedamija

@wedamija wedamija commented Aug 7, 2026

Copy link
Copy Markdown
Member

This splits out the response serializers from #121403 to keep the total pr size down, and restructures them into separate folders.

@wedamija
wedamija requested a review from arslnb August 7, 2026 23:06
@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Aug 7, 2026
Comment thread src/sentry/investigations/endpoints/serializers/block.py Outdated

@cursor cursor Bot left a comment

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.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 22b59ea. Configure here.

Comment thread src/sentry/investigations/endpoints/serializers/block.py
Comment thread src/sentry/investigations/endpoints/serializers/investigation.py Outdated
Comment thread src/sentry/investigations/endpoints/serializers/block.py
Comment on lines +157 to +173
"position": obj.position,
"kind": obj.kind,
"title": obj.title,
"content": content,
"generationPrompt": obj.prompt,
"generatedContent": generated_content,
"output": output,
"outputStatus": output_status,
"currentExecution": (
{
"id": str(execution.id),
"status": execution.status,
"executor": execution.executor,
"schemaVersion": execution.result_schema_version,
"startedAt": execution.started_at,
"completedAt": execution.completed_at,
"error": execution.error,

@sentry-warden sentry-warden Bot Aug 8, 2026

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.

Execution error field bypasses project access control in block serializer

currentExecution.error is serialized even when is_accessible returns False, potentially exposing stack traces or SQL fragments from restricted project executions.

Evidence
  • InvestigationBlockExecution.error is a JSONField(null=True) on block_execution.py:68 with no schema constraint, so it may hold stack traces, SQL fragments, or internal paths from Seer runs.
  • is_accessible(execution) (block.py:114-118) gates the output and content fields based on accessible_project_ids, but currentExecution is built unconditionally when execution is not None.
  • The error key inside currentExecution is included on line 173 without any accessibility check, so a viewer blocked from seeing a block's result can still receive the execution's error payload.
Also found at 1 additional location
  • src/sentry/investigations/endpoints/serializers/investigation.py:148

Identified by Warden · wrdn-data-exfil, security-review · H6E-FH6

This splits out the response serializers from #121403 to keep the total pr size down, and restructures them into separate folders.
@wedamija
wedamija force-pushed the danf/investigations-serializers branch from 0757dc0 to 1f11584 Compare August 10, 2026 18:54

@arslnb arslnb left a comment

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.

Looks good, the warden comment shouldn't matter since this response (or error) is already visible to the user via the explorer flow

@wedamija
wedamija merged commit 942828d into master Aug 10, 2026
65 checks passed
@wedamija
wedamija deleted the danf/investigations-serializers branch August 10, 2026 19:23
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.

2 participants