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
fix(security): close RCE via PR title, stop leaking secrets, harden runner (#65)
The runner entrypoint built a sed script out of the PR title, so a title
could close the s command and chain GNU sed's `e` -- which shells out.
Reproduced in the real image: a title of
benign-looking title|;e id > /tmp/PWNED #
executed as the runner user, which holds CLAUDE_CODE_OAUTH_TOKEN and
GITHUB_TOKEN, and the rendered prompt showed no trace of the payload.
The same line broke on any title containing a plain `|`, aborting before
emit_error could run and leaving the frontend a dead session with no
reason. Substitution now goes through awk with the value passed via the
environment and matched with index()/substr(), so no byte of PR-controlled
data is parsed as a pattern or as code.
Settings rendered every credential in cleartext through repr(), while
sentry_sdk.init defaults to include_local_variables=True and a live
`settings` sits in a dozen frames that can raise -- one unhandled 500 was
enough to ship the whole set to a third party. Credentials are SecretStr
now; SecretStr defines __len__, so existing truthiness checks still hold.
Also:
- PidsLimit, CapDrop ALL and no-new-privileges on the one container that
runs `claude --dangerously-skip-permissions` over attacker-authored PRs
- rate limit the SQLAdmin login: slowapi resolves handlers via
hasattr(route, "endpoint"), so the whole /admin Mount was exempt and
guessing against the shared password was unbounded
- ENVIRONMENT is a Literal, so a typo can no longer skip the production
secret validation silently
- CORS registered last (outermost) per the documented convention, plus
expose_headers so the frontend can read X-Request-ID
- shellcheck in CI over the entrypoint, the file where this bug lived and
the only code in the repo with no linter over it
- drop ANTHROPIC_API_KEY and the two LEMONSQUEEZY_* settings, unread since
the pivot, and the unused PR_DIFF shell variable shellcheck flagged
0 commit comments