-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
feat(developer-settings): add webhook_headers backend support #116901
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
Closed
Closed
Changes from all commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
711038b
feat(developer-settings): add webhook_headers model field, API, and w…
sentry-junior[bot] 0eae918
feat(developer-settings): add webhook_headers model field, API, and w…
sentry-junior[bot] 608bc18
feat(developer-settings): add webhook_headers model field, API, and w…
sentry-junior[bot] 47ab6ba
feat(developer-settings): add webhook_headers model field, API, and w…
sentry-junior[bot] 0a0f138
feat(developer-settings): add webhook_headers model field, API, and w…
sentry-junior[bot] c3e8acf
feat(developer-settings): add webhook_headers model field, API, and w…
sentry-junior[bot] a900d7e
feat(developer-settings): add webhook_headers model field, API, and w…
sentry-junior[bot] 13c35fb
feat(developer-settings): add webhook_headers model field, API, and w…
sentry-junior[bot] e7a8b85
feat(developer-settings): add webhook_headers model field, API, and w…
sentry-junior[bot] c323e4f
feat(developer-settings): add webhook_headers model field, API, and w…
sentry-junior[bot] c92d7fe
feat(developer-settings): add webhook_headers model field, API, and w…
sentry-junior[bot] 3071914
feat(developer-settings): add webhook_headers model field, API, and w…
sentry-junior[bot] b8728cc
feat(developer-settings): add webhook_headers model field, API, and w…
sentry-junior[bot] 57657d5
feat(developer-settings): add webhook_headers model field, API, and w…
sentry-junior[bot] d89c04f
feat(developer-settings): add webhook_headers backend support
sentry-junior[bot] 72146d3
feat(developer-settings): add webhook_headers backend support
sentry-junior[bot] da59aa5
feat(developer-settings): add webhook_headers backend support
sentry-junior[bot] c053272
feat(developer-settings): add webhook_headers backend support
sentry-junior[bot] 48d6ad5
feat(developer-settings): add webhook_headers backend support
sentry-junior[bot] 68783a5
feat(developer-settings): add webhook_headers backend support
sentry-junior[bot] 211f5f0
feat(developer-settings): add webhook_headers backend support
sentry-junior[bot] a05a6ad
feat(developer-settings): add webhook_headers backend support
sentry-junior[bot] 7a63919
feat(developer-settings): add webhook_headers backend support
sentry-junior[bot] 503ea33
feat(developer-settings): add webhook_headers backend support
sentry-junior[bot] 9497c43
feat(developer-settings): add webhook_headers backend support
sentry-junior[bot] 3b11c0b
feat(developer-settings): add webhook_headers backend support
sentry-junior[bot] 1d8cd1e
feat(developer-settings): add webhook_headers backend support
sentry-junior[bot] ddb61af
feat(developer-settings): add webhook_headers backend support
sentry-junior[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| import django.contrib.postgres.fields | ||
| from django.db import migrations, models | ||
|
|
||
| from sentry.new_migrations.migrations import CheckedMigration | ||
|
|
||
|
|
||
| class Migration(CheckedMigration): | ||
| # This flag is used to mark that a migration shouldn't be automatically run in production. | ||
| # This should only be used for operations where it's safe to run the migration after your | ||
| # code has deployed. So this should not be used for most operations that alter the schema | ||
| # of a table. | ||
| # Here are some things that make sense to mark as post deployment: | ||
| # - Large data migrations. Typically we want these to be run manually so that they can be | ||
| # monitored and not block the deploy for a long period of time while they run. | ||
| # - Adding indexes to large tables. Since this can take a long time, we'd generally prefer to | ||
| # run this outside deployments so that we don't block them. Note that while adding an index | ||
| # is a schema change, it's completely safe to run the operation after the code has deployed. | ||
| # Once deployed, run these manually via: https://develop.sentry.dev/database-migrations/#migration-deployment | ||
|
|
||
| is_post_deployment = False | ||
|
|
||
| dependencies = [ | ||
| ("sentry", "1108_drop_organizationmapping_codecov_access_pending"), | ||
| ] | ||
|
|
||
| operations = [ | ||
| migrations.AddField( | ||
| model_name="sentryapp", | ||
| name="webhook_headers", | ||
| field=django.contrib.postgres.fields.ArrayField( | ||
| base_field=models.TextField(), default=list, size=None | ||
| ), | ||
| ), | ||
| ] |
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
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
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
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
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
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
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
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
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
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
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Custom webhook headers exposed unmasked in GET responses for published Sentry Apps
SentryAppSerializerreturnswebhookHeadersverbatim in the GET response for any Sentry App, andSentryAppPermission.has_object_permissionlets any authenticated user GET a published app's details. Sincewebhook_headersis designed to carry per-app credentials (e.g.Authorization: Bearer ...), any Sentry user can read another org's webhook secrets viaGET /api/0/sentry-apps/{slug}/. Mask the values likeclientSecretdoes, or restrict exposure to org members withorg:write.Evidence
src/sentry/sentry_apps/api/serializers/sentry_app.py:150setswebhookHeaders=obj.webhook_headersunconditionally inSentryAppSerializerResponse, with noMASKED_VALUEbranch (contrast withclientSecretlater in the sameserialize).src/sentry/sentry_apps/api/bases/sentryapps.py:272returnsTruefromSentryAppPermission.has_object_permissionwheneversentry_app.is_published and request.method == 'GET', so any authenticated user passes the object permission check on the details endpoint.SentryAppDetailsEndpoint(endpoints/sentry_app_details.py:57-65) usesSentryAppDetailsEndpointPermission(a subclass ofSentryAppAndStaffPermission→SentryAppPermission) and callsserialize(sentry_app, ..., ResponseSentryAppSerializer())for GET, so the unmasked headers reach the response body.Authorization: Bearer ..., confirming the field is intended to carry secret credentials and is not just metadata.Also found at 6 additional locations
src/sentry/sentry_apps/api/serializers/sentry_app.py:48src/sentry/sentry_apps/api/serializers/sentry_app.py:150src/sentry/sentry_apps/logic.py:117src/sentry/sentry_apps/logic.py:352src/sentry/sentry_apps/services/app/model.py:88tests/sentry/sentry_apps/api/endpoints/test_sentry_apps.py:762-766Identified by Warden security-review · XPX-475