Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(auth): Adding scoping_organization_id to replica #81213

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

sentaur-athena
Copy link
Member

@sentaur-athena sentaur-athena commented Nov 22, 2024

Adding scoping_organization_id to both ApiTokenReplica and SystemToken. The reason is that we want to limit auth tokens that are scoped to a specific organizations to any other organization.
Context on why we need this is here: #81193

@sentaur-athena sentaur-athena requested review from a team as code owners November 22, 2024 21:16
@sentaur-athena sentaur-athena marked this pull request as draft November 22, 2024 21:16
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Nov 22, 2024
Copy link

codecov bot commented Nov 22, 2024

❌ 1 Tests Failed:

Tests completed Failed Passed Skipped
23171 1 23170 214
View the top 1 failed tests by shortest run time
tests.sentry.backup.test_comparators::test_default_comparators
Stack Traces | 0.394s run time
#x1B[1m#x1B[.../sentry/backup/test_comparators.py#x1B[0m:2162: in test_default_comparators
    insta_snapshot(serialized)
#x1B[1m#x1B[31mE   Failed: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#x1B[0m
#x1B[1m#x1B[31mE   Snapshot .../snapshots/test_comparators/test_default_comparators.pysnap changed!#x1B[0m
#x1B[1m#x1B[31mE   #x1B[0m
#x1B[1m#x1B[31mE   #x1B[0m
#x1B[1m#x1B[31mE   Re-run pytest with SENTRY_SNAPSHOTS_WRITEBACK=new and then use 'make review-python-snapshots' to review.#x1B[0m
#x1B[1m#x1B[31mE   #x1B[0m
#x1B[1m#x1B[31mE   Or: Use SENTRY_SNAPSHOTS_WRITEBACK=1 to update snapshots directly.#x1B[0m
#x1B[1m#x1B[31mE   #x1B[0m
#x1B[1m#x1B[31mE   #x1B[0m
#x1B[1m#x1B[31mE   --- #x1B[0m
#x1B[1m#x1B[31mE   #x1B[0m
#x1B[1m#x1B[31mE   +++ #x1B[0m
#x1B[1m#x1B[31mE   #x1B[0m
#x1B[1m#x1B[31mE   @@ -28,6 +28,7 @@#x1B[0m
#x1B[1m#x1B[31mE   #x1B[0m
#x1B[1m#x1B[31mE        - apitoken_id#x1B[0m
#x1B[1m#x1B[31mE        - application_id#x1B[0m
#x1B[1m#x1B[31mE        - organization#x1B[0m
#x1B[1m#x1B[31mE   +    - scoping_organization_id#x1B[0m
#x1B[1m#x1B[31mE        - user_id#x1B[0m
#x1B[1m#x1B[31mE      model_name: hybridcloud.apitokenreplica#x1B[0m
#x1B[1m#x1B[31mE    - comparators:#x1B[0m
#x1B[1m#x1B[31mE   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#x1B[0m

To view more test analytics, go to the Test Analytics Dashboard
Got feedback? Let us know on Github

@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Nov 22, 2024
Copy link
Contributor

🚨 Warning: This pull request contains Frontend and Backend changes!

It's discouraged to make changes to Sentry's Frontend and Backend in a single pull request. The Frontend and Backend are not atomically deployed. If the changes are interdependent of each other, they must be separated into two pull requests and be made forward or backwards compatible, such that the Backend or Frontend can be safely deployed independently.

Have questions? Please ask in the #discuss-dev-infra channel.

Copy link
Contributor

This PR has a migration; here is the generated SQL for src/sentry/hybridcloud/migrations/0017_add_scoping_organization_apitokenreplica.py ()

--
-- Add field scoping_organization_id to apitokenreplica
--
ALTER TABLE "hybridcloud_apitokenreplica" ADD COLUMN "scoping_organization_id" bigint NULL;
CREATE INDEX CONCURRENTLY "hybridcloud_apitokenreplica_scoping_organization_id_a73a089b" ON "hybridcloud_apitokenreplica" ("scoping_organization_id");

Copy link
Member

@wedamija wedamija left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Migration lgtm.

I'd recommend for https://github.com/getsentry/getsentry/pull/15812 to merge before you merge this. We've been having issues with migrations timing out during deploys

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 Scope: Frontend Automatically applied to PRs that change frontend components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants