Repository navigation
feat(aci): Track service account and org token creators on detectors - #129550
Merged
Merged
Conversation
…and workflows Add created_by_service_account_id and created_by_org_auth_token_id to Detector and Workflow, with a single-creator check constraint. API create paths, including legacy cron and uptime monitor creation, now record the creator via get_creator_reference. Fixes ENG-8937
Contributor
|
This PR has a migration; here is the generated SQL for for --
-- Add field created_by_org_auth_token_id to detector
--
ALTER TABLE "workflow_engine_detector" ADD COLUMN "created_by_org_auth_token_id" bigint NULL;
--
-- Add field created_by_service_account_id to detector
--
ALTER TABLE "workflow_engine_detector" ADD COLUMN "created_by_service_account_id" bigint NULL;
--
-- Create constraint workflow_engine_detector_single_creator on model detector
--
ALTER TABLE "workflow_engine_detector" ADD CONSTRAINT "workflow_engine_detector_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_detector" VALIDATE CONSTRAINT "workflow_engine_detector_single_creator";
CREATE INDEX CONCURRENTLY "workflow_engine_detector_created_by_org_auth_token_id_14fce493" ON "workflow_engine_detector" ("created_by_org_auth_token_id");
CREATE INDEX CONCURRENTLY "workflow_engine_detector_created_by_service_account_id_8ac26027" ON "workflow_engine_detector" ("created_by_service_account_id"); |
Tolerate requests without auth in get_creator_reference, allow blank creator fields on Workflow, and drop org auth token creator references on relocation import since tokens are imported last.
Move the workflow half into a stacked PR so detectors and workflows can be reviewed separately.
DominikB2014
marked this pull request as ready for review
November 9, 2026 19:27
…e-non-user-creator # Conflicts: # migrations_lockfile.txt # tests/sentry/workflow_engine/endpoints/test_validators.py
DominikB2014
marked this pull request as draft
November 12, 2026 17:58
DominikB2014
marked this pull request as ready for review
November 16, 2026 17:14
DominikB2014
added a commit
that referenced
this pull request
Nov 16, 2026
…rt (#129571) Follow-up to #129219: org auth tokens are imported last during relocation, so a dashboard with `created_by_org_auth_token_id` can't be remapped and is silently dropped. - `Dashboard.normalize_before_relocation_import` clears `created_by_org_auth_token_id` so the dashboard imports without that creator. - Same override as #129550 (detectors/workflows). Refs ENG-8934
…130482) Stacked on #129550 (detectors). This adds service account and org auth tokens ids, 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 Workflows 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 `Workflow`, with an at-most-one-creator check constraint (same as #129219 for dashboards). - The workflow validator records the creator with `get_creator_reference(request)`. Refs ENG-8937
…e-non-user-creator Co-Authored-By: Dominik Buszowiecki <[email protected]> # Conflicts: # migrations_lockfile.txt
Co-Authored-By: Dominik Buszowiecki <[email protected]>
edwardgou-sentry
left a comment
Contributor
There was a problem hiding this comment.
did you want to separate out the pr for the workflow model and the detector model? Looks like theres two migrations and the pr description says Workflows are in a stacked PR on top of this one.
Workflow changes now live in a separate PR stacked on this one. Co-Authored-By: Dominik Buszowiecki <[email protected]>
edwardgou-sentry
approved these changes
Nov 25, 2026
Co-Authored-By: Dominik Buszowiecki <[email protected]>
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
created_by_service_account_id/created_by_org_auth_token_idtoDetector, with an at-most-one-creator check constraint (same as feat(dashboards): Track service account and org token creators #129219 for dashboards).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_enginemigration, so whichever merges second needs its migration renumbered.Fixes ENG-8937
via @DominikB2014.
--
View Session [Sentry]