Skip to content

fix(security): Don't interpolate values in orgs' sentry_config.ini - #176

Merged
armenzg merged 1 commit into
mainfrom
fix/config-no-interpolation
Nov 17, 2026
Merged

armenzg merged 1 commit into
mainfrom
fix/config-no-interpolation

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

Category: application security (denial of service in request handling).

Vulnerability

_fetch_config parses each org's .sentry/sentry_config.ini with a plain ConfigParser(), which turns on BasicInterpolation. Interpolation expands %(key)s references recursively with no memoization or size limit. CPython only caps nesting depth at 10, so the work grows as references per line ^ 10. In a file of a few hundred bytes, each level can reference the one below it ten times (v1 = %(v0)s%(v0)s…, and so on up to dsn = %(v9)s). That makes cp.get(section, "dsn") build a value of about 10^9 characters.

Anyone can trigger this. The GitHub App is public, so an attacker installs it on their own account, commits a file like this to their own .sentry repo, and runs any workflow. The app parses the file again on every workflow_job webhook because a failed parse isn't cached.

Severity: medium

The image runs one gunicorn worker with 4 threads and --timeout 0, so nothing kills a stuck request. Each malicious webhook takes a thread, holds CPU (and the GIL) for hours, and keeps using more memory until the instance runs out. A handful of webhooks stops the app for every org that installed it, and GitHub doesn't redeliver the webhooks that fail. The attacker can't read or change other orgs' data.

Evidence

On Python 3.15.2 (the image's version), a 402-byte file with 6 references per line took 110 s and about 100 MB to expand to 10M characters. Each extra reference per line makes it about 5× slower. With interpolation off, the same file parses in under a millisecond. CPython main has the same BasicInterpolation._interpolate_some, so a newer Python won't fix it. This doesn't depend on production config or scrubbing. The sentry/sentry-github-actions-app project shows this path running for many unrelated third-party installations (for example event 911786e43ad54672b5fb6887dd96f1c0).

Fix

Parse the file with ConfigParser(interpolation=None). dsn and commit_workflows never need interpolation, and DSNs and workflow file names don't contain %. The only behavior change is that a literal % is now read as-is, where it used to raise an error. No open PR or issue covered this.

via automation sched_2663accc24a4cb8adfb43de4543ec71e · Run ID sched_2663accc24a4cb8adfb43de4543ec71e:1794918600000.

--

View Session [Sentry]

@sentry-junior
sentry-junior Bot requested a review from a team as a code owner November 17, 2026 12:39
@sentry-junior
sentry-junior Bot requested a review from armenzg November 17, 2026 12:39
@armenzg
armenzg merged commit 042a191 into main Nov 17, 2026
17 checks passed
@armenzg
armenzg deleted the fix/config-no-interpolation branch November 17, 2026 12:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant