Repository navigation
fix(auth): preserve token refreshes across caller cancellation #1172
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
b480735
fix(stack-auth)!: finish token refreshes after caller cancellation
coderdan 6052281
test(auth): run native guest exchange under Tokio
coderdan 6a16ca4
test(auth): cover token expiry boundaries in refresh
coderdan e71d061
fix(stack-auth): give the initiating caller the token its refresh ins…
coderdan f1b6a7c
test(stack-auth): run the cancellation soak on a multi-thread runtime
coderdan 0b57ae7
docs(golang): say why the auth guest's block_on is wasm32-only
coderdan d0bdaec
ci(release-plz): run the auth refresh soak only on an armed crates line
coderdan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| '@cipherstash/auth': patch | ||
| --- | ||
|
|
||
| Keep native token refreshes running when their caller is cancelled, so rotated device-session credentials are saved and subsequent requests can still authenticate. Close a refresh-waiter notification race, and give the caller that started a refresh the new token rather than the expiring one it replaced. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| name: Auth refresh cancellation soak | ||
|
|
||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| long: | ||
| type: boolean | ||
| default: false | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| soak: | ||
| runs-on: blacksmith-16vcpu-ubuntu-2204 | ||
| timeout-minutes: 30 | ||
| env: | ||
| MISE_ENV: test | ||
| NEXTEST_PROFILE: ci | ||
| steps: | ||
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 | ||
| with: | ||
| persist-credentials: false | ||
| - uses: jdx/mise-action@1648a7812b9aeae629881980618f079932869151 # v4 | ||
| with: | ||
| version: 2026.4.0 | ||
| install: true | ||
| working_directory: . | ||
| cache: true | ||
| cache_key_prefix: mise-v1-ubuntu-2204 | ||
| - uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2 | ||
| - name: Short seeded soak | ||
| if: ${{ !inputs.long }} | ||
| run: cargo nextest run --locked -p stack-auth --all-features -E 'test(cancellation_soak_short)' --success-output final | ||
| - name: Long seeded soak | ||
| if: inputs.long | ||
| run: mise run test:soak:stack-auth |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| name: Tests (auth refresh cancellation) | ||
|
|
||
| # The short run covers every PR, including Version Packages. The longer run | ||
| # also covers release PRs and changes to the engine, refreshers or toolchain. | ||
| on: | ||
| pull_request: {} | ||
| workflow_dispatch: {} | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| short: | ||
| uses: ./.github/workflows/_test-auth-refresh-soak.yml | ||
|
|
||
| changes: | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 5 | ||
| permissions: | ||
| contents: read | ||
| pull-requests: read | ||
| outputs: | ||
| refresh: ${{ steps.paths.outputs.refresh }} | ||
| steps: | ||
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 | ||
| with: | ||
| persist-credentials: false | ||
| - uses: dorny/paths-filter@0e4a8c6effa4802afeda77dc8d303f8176d7dfad # v3 | ||
| id: paths | ||
| with: | ||
| filters: | | ||
| refresh: | ||
| - 'packages/stack-auth/**' | ||
| - 'Cargo.toml' | ||
| - 'Cargo.lock' | ||
| - 'mise*.toml' | ||
| - '.config/nextest.toml' | ||
| - '.github/workflows/*auth-refresh*.yml' | ||
| - '.github/workflows/release-plz.yml' | ||
|
|
||
| long: | ||
| needs: changes | ||
| if: github.event_name == 'workflow_dispatch' || github.head_ref == 'changeset-release/main' || needs.changes.outputs.refresh == 'true' | ||
| uses: ./.github/workflows/_test-auth-refresh-soak.yml | ||
| with: | ||
| long: true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.