Skip to content

fix(flight): reject malformed unary bearer headers#941

Merged
zeroshade merged 1 commit into
apache:mainfrom
fallintoplace:fix/flight-unary-bearer-auth
Jul 15, 2026
Merged

fix(flight): reject malformed unary bearer headers#941
zeroshade merged 1 commit into
apache:mainfrom
fallintoplace:fix/flight-unary-bearer-auth

Conversation

@fallintoplace

@fallintoplace fallintoplace commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Rationale for this change

The unary bearer interceptor used a prefix check and then sliced past an assumed space. An authorization value containing exactly Bearer could therefore panic, while values such as BearerX token were treated as bearer credentials.

What changes are included in this PR?

Parse the authorization scheme and credential separately, require the exact Bearer scheme and a non-empty credential, and reject malformed headers before invoking the validator. Additional spaces before the credential are accepted.

Are these changes tested?

Yes. Regression coverage includes missing headers, missing credentials, malformed schemes, and valid credentials separated by multiple spaces. go test ./arrow/flight and the race-enabled package test pass.

Are there any user-facing changes?

Missing or malformed bearer headers now return Unauthenticated instead of reaching the validator or panicking. Multiple spaces after the scheme are accepted.

@fallintoplace
fallintoplace requested a review from zeroshade as a code owner July 15, 2026 03:40
@fallintoplace
fallintoplace force-pushed the fix/flight-unary-bearer-auth branch from 1eefcb8 to 047ac64 Compare July 15, 2026 03:51
@fallintoplace fallintoplace changed the title fix(flight): validate bearer authorization in unary interceptor fix(flight): reject malformed unary bearer headers Jul 15, 2026

@zeroshade zeroshade left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM — verified the fix and its test coverage. Thanks!

@zeroshade
zeroshade merged commit 1394c6e into apache:main Jul 15, 2026
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