Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix: trim whitespace from API tokens#19814

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation

ThomasK33
Copy link
Member

@ThomasK33ThomasK33 commentedSep 15, 2025
edited
Loading

Trim whitespace from API tokens in Authorization headers and query parameters

This PR enhances the API token extraction logic by trimming whitespace from tokens obtained via:

  1. Authorization: Bearer headers
  2. access_token query parameters

The change ensures consistent token handling when tokens contain leading or trailing whitespace, improving authentication reliability.

The PR also removes unnecessaryt.Parallel() calls from OAuth2 bearer token tests to prevent potential race conditions during test execution.

Fixes:coder/internal#967

Fixes flake where subtests used t.Parallel() while sharing a DB from dbtestutil.NewDB(t). On Windows, the parent test’s t.Cleanup closed the DB before parallel subtests finished, yielding intermittent 401 Unauthorized instead of 200. Serializing the subtests keeps the DB alive for each case and removes the flake.Also trims whitespace from Authorization: Bearer and access_token token extraction for robustness; no change to precedence or overall behavior.Change-Id: Ifa9ad5bb297dc96612dbfb9ef8bb0e16d8ce5778Signed-off-by: Thomas Kosiewski <tk@coder.com>
@ThomasK33Graphite App
Copy link
MemberAuthor

This stack of pull requests is managed byGraphite. Learn more aboutstacking.

@ThomasK33ThomasK33 marked this pull request as ready for reviewSeptember 15, 2025 07:57
@ThomasK33ThomasK33 merged commitd238480 intomainSep 15, 2025
38 checks passed
@ThomasK33ThomasK33 deleted the thomask33/09-12-test_httpmw_deflake_rfc6750_bearer_token_tests_on_windows branchSeptember 15, 2025 08:02
@github-actionsgithub-actionsbot locked and limited conversation to collaboratorsSep 15, 2025
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.
Reviewers

@johnstcnjohnstcnjohnstcn approved these changes

@EmyrkEmyrkAwaiting requested review from Emyrk

Assignees

@ThomasK33ThomasK33

Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

flake: TestOAuth2BearerTokenPrecedence and TestRFC6750BearerTokenAuthentication
2 participants
@ThomasK33@johnstcn

[8]ページ先頭

©2009-2025 Movatter.jp