You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 9d5b6ab
Browse filesBrowse the repository at this point in the historyBrowse files
fix(security): Require a webhook signature and keep workflows in the payload's repo (#126)
* fix(security): Require a webhook signature and keep workflows in the payload's repo
Without GH_WEBHOOK_SECRET the app accepted unsigned payloads, so anyone could
make it mint a token for any installation and read any GitHub API path with it.
Reject every payload when the secret is unset, and treat a missing signature
header as invalid instead of raising.
Also reject payloads whose run_url, or workflow_run repository, points outside
the payload's repository, or whose owner doesn't match the repository. The DSN
comes from the owner's .sentry repo, so a mismatch would send one repo's data
to another org's Sentry project.
Co-Authored-By: Armen Zambrano Gasparnian <44410+armenzg@users.noreply.github.com>
* fix(security): Reject repository names that hold a path
Only the owner part of repository.full_name was checked, so a name like
getsentry/../victim/private passed and ended up in the API URL.
---------
Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com>
Co-authored-by: Armen Zambrano Gasparnian <44410+armenzg@users.noreply.github.com>
Copy file name to clipboardExpand all lines: docs/deployment.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,7 +13,7 @@ A Sentry project tracks errors of the backend itself. Its DSN is `APP_DSN`.
13
13
| Variable | Purpose |
14
14
| --- | --- |
15
15
|`APP_DSN`| Optional. Reports the app's own errors and performance to Sentry. |
16
-
|`GH_WEBHOOK_SECRET`| Secret shared with the GitHub webhook. When unset, the app accepts unsigned requests. Generate one with `python3 -c 'import secrets; print(secrets.token_urlsafe(20))'`. |
16
+
|`GH_WEBHOOK_SECRET`|Required. Secret shared with the GitHub webhook. The app rejects requests that aren't signed with it, and rejects every request when it's unset. Generate one with `python3 -c 'import secrets; print(secrets.token_urlsafe(20))'`. |
17
17
|`GH_APP_ID`| GitHub App ID, shown on the GitHub App page. Setting it turns on GitHub App mode. |
18
18
|`GH_APP_PRIVATE_KEY`| Base64-encoded GitHub App private key. On Cloud Run (`K_SERVICE` set) without this variable, the app reads the key from Google Secret Manager instead. See `get_gh_app_private_key` in `src/web_app_handler.py`. |
19
19
|`GH_TOKEN`| Optional personal access token. The app uses it when `GH_APP_ID` is unset or the private key fails to load. |
Copy file name to clipboardExpand all lines: docs/development.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -37,7 +37,7 @@ The argument must be a job URL. For a job in the `getsentry` org, you can set `I
37
37
1. Start the app with `flask run -p 5001`.
38
38
2. Start ngrok with `ngrok http 5001` and note the URL.
39
39
3. Create a separate GitHub App for development, configured as in [deployment.md](deployment.md#configure-the-github-app), with its webhook URL set to the ngrok URL.
40
-
4. Generate a private key for it and set `GH_APP_ID`and `GH_APP_PRIVATE_KEY` locally. Put secrets in `.env`, which `.envrc` loads.
40
+
4. Generate a private key for it and set `GH_APP_ID`, `GH_APP_PRIVATE_KEY`, and the app's webhook secret as `GH_WEBHOOK_SECRET` locally. Put secrets in `.env`, which `.envrc` loads.
41
41
5. Delete the private key from the GitHub App when you finish.
42
42
43
43
Fixtures can carry old timestamps. Sentry then shows "Clock drift detected in SDK" on the transaction. You can ignore it.
0 commit comments