Skip to content

fix(client): Reject push requests with a missing or invalid signature - #836

Merged
untitaker merged 1 commit into
getsentry:mainfrom
theminjunchoi:fix/push-worker-signature-check
Oct 29, 2026
Merged

untitaker merged 1 commit into
getsentry:mainfrom
theminjunchoi:fix/push-worker-signature-check

Conversation

@theminjunchoi

Copy link
Copy Markdown
Contributor

The push worker's RequestSignatureServerInterceptor checks the signature inside the request deserializer and hands the result to the servicer through a thread-local. That only works if both run on the same thread, and on grpcio's sync server they don't: the deserializer runs on the server's polling thread and the servicer on a pool thread. So the servicer never sees a failed check, and a PushTask with a missing or wrong sentry-signature gets OK and goes through with an empty request.

Now the deserializer returns a marker object when the check fails, and the servicer aborts with UNAUTHENTICATED when it gets one. The result travels with the request, so the threading no longer matters.

The new test starts a real grpcio server with the interceptor and sends four calls: no signature, the wrong secret, a signature for a different body, and a valid one. On main the first three come back OK. With this change they get UNAUTHENTICATED and only the valid call reaches the handler.

I reported this to security@sentry.io first, and they said they'd be happy to review a PR with the fix and a test.

RequestSignatureServerInterceptor passed a failed signature check from the
request deserializer to the servicer through a thread-local. grpcio's sync
server deserializes on its polling thread and runs the servicer on a pool
thread, so the servicer never saw the flag and calls with a missing or wrong
sentry-signature got OK with an empty request.

Return a marker from the deserializer instead and abort with UNAUTHENTICATED
when the servicer gets it. The new test sends signed and unsigned calls
through a real grpcio server.

Signed-off-by: MinJun Choi <mj04300017@gmail.com>
@theminjunchoi
theminjunchoi requested a review from a team as a code owner October 29, 2026 12:18
@untitaker

untitaker commented Oct 29, 2026 •

Copy link
Copy Markdown
Member

ref STREAM-1099 was the same thing (reported by AI), but we were unable to produce a fix with low effort at the time, so it disappeared in the backlog. I'll just get this merged. ty for reporting!

@untitaker
untitaker enabled auto-merge (squash) October 29, 2026 12:43
@untitaker
untitaker merged commit 7d82374 into getsentry:main Oct 29, 2026
26 checks passed
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.

2 participants