Skip to content

feat(aci): Track service account and org token creators on workflows - #132450

Merged
DominikB2014 merged 2 commits into
masterfrom
feat/workflow-non-user-creator
Nov 25, 2026
Merged

DominikB2014 merged 2 commits into
masterfrom
feat/workflow-non-user-creator

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

This adds service account and org auth token ids, so we can track who created resources. Eventually this will help serve optional guardrails that will allow creators to modify/delete their own resources but not others.

Workflows only recorded a user creator, so ones created by service accounts or org auth tokens had no author.

The detector side landed in #129550.

Refs ENG-8937

via @DominikB2014.

--

View Session [Sentry]

@linear-code

linear-code Bot commented Nov 24, 2026

Copy link
Copy Markdown

ENG-8937

@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Nov 24, 2026
Add created_by_service_account_id and created_by_org_auth_token_id to Workflow, and record them from the workflow validator via get_creator_reference.

Co-Authored-By: Dominik Buszowiecki <[email protected]>
@sentry-junior
sentry-junior Bot force-pushed the feat/workflow-non-user-creator branch from 97218e4 to 76afefc Compare November 25, 2026 15:05
@github-actions github-actions Bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Nov 25, 2026
@sentry-junior
sentry-junior Bot removed this pull request from stack #132452 November 25, 2026 15:06
@sentry-junior
sentry-junior Bot changed the base branch from feat/workflow-engine-non-user-creator to master November 25, 2026 15:07
@sentry

sentry Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Sentry Snapshot Testing

Name Added Removed Changed Renamed Unchanged Skipped Status
sentry-frontend
sentry-frontend
0 0 0 0 1084 0 ✅ Unchanged

⚙️ sentry-frontend Snapshot Settings

@github-actions

github-actions Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

This PR has a migration; here is the generated SQL for src/sentry/workflow_engine/migrations/0129_add_workflow_non_user_creator.py

for 0129_add_workflow_non_user_creator in workflow_engine

--
-- Add field created_by_org_auth_token_id to workflow
--
ALTER TABLE "workflow_engine_workflow" ADD COLUMN "created_by_org_auth_token_id" bigint NULL;
--
-- Add field created_by_service_account_id to workflow
--
ALTER TABLE "workflow_engine_workflow" ADD COLUMN "created_by_service_account_id" bigint NULL;
--
-- Create constraint workflow_engine_workflow_single_creator on model workflow
--
ALTER TABLE "workflow_engine_workflow" ADD CONSTRAINT "workflow_engine_workflow_single_creator" CHECK ((("created_by_service_account_id" IS NULL AND "created_by_org_auth_token_id" IS NULL) OR ("created_by_id" IS NULL AND "created_by_org_auth_token_id" IS NULL) OR ("created_by_id" IS NULL AND "created_by_service_account_id" IS NULL))) NOT VALID;
ALTER TABLE "workflow_engine_workflow" VALIDATE CONSTRAINT "workflow_engine_workflow_single_creator";
CREATE INDEX CONCURRENTLY "workflow_engine_workflow_created_by_org_auth_token_id_fb9da085" ON "workflow_engine_workflow" ("created_by_org_auth_token_id");
CREATE INDEX CONCURRENTLY "workflow_engine_workflow_created_by_service_account_id_738c24e3" ON "workflow_engine_workflow" ("created_by_service_account_id");

@DominikB2014
DominikB2014 marked this pull request as ready for review November 25, 2026 17:32
@DominikB2014
DominikB2014 requested review from a team as code owners November 25, 2026 17:32
@sentry-junior
sentry-junior Bot requested a review from DominikB2014 November 25, 2026 17:32
DominikB2014 added a commit that referenced this pull request Nov 25, 2026
…129550)

This adds service account and org auth tokens, so we can track whos
created resources. Eventually this will help serve optional guardrails
that will allow creators to modify/delete their own resources but not
others.

## Generated description

Detectors only recorded a user creator, so ones created by service
accounts or org auth tokens had no author.

- Add `created_by_service_account_id` / `created_by_org_auth_token_id`
to `Detector`, with an at-most-one-creator check constraint (same as
#129219 for dashboards).
- The detector validator uses `get_creator_reference(request)`. The
legacy `/monitors/` (`ensure_cron_detector`) and legacy uptime
(`create_uptime_detector`) create paths now record the creator too.

Workflows are in #132450. The two PRs are independent,
but both add the next `workflow_engine` migration, so whichever merges
second needs its migration renumbered.

Fixes ENG-8937

<!-- junior-request-attribution:start -->
via @DominikB2014.
<!-- junior-request-attribution:end -->

<!-- junior-session-footer:start -->
<!-- junior-conversation-id:slack%3AC0CLH9SJT1N%3A1795553613.104619 -->

--

[View
Session](https://junior-prod.sentry.dev/conversations/slack%3AC0CLH9SJT1N%3A1795553613.104619)
[[Sentry]](https://sentry.sentry.io/explore/conversations/slack%3AC0CLH9SJT1N%3A1795553613.104619/?project=4510944073809921)

<!-- junior-session-footer:end -->

---------

Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com>
@github-actions github-actions Bot removed the Scope: Frontend Automatically applied to PRs that change frontend components label Nov 25, 2026
@DominikB2014
DominikB2014 merged commit 5df3011 into master Nov 25, 2026
107 of 109 checks passed
@DominikB2014
DominikB2014 deleted the feat/workflow-non-user-creator branch November 25, 2026 19:37

This branch was successfully deployed

1 active deployment
Preview — 53964cfe Deployed Nov 25, 2026 by vercel[bot]
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