fix: thread resolved share URL into lazyBackfillAuthUserID#398
Merged
tomasz-tomczyk merged 1 commit intomainfrom Apr 30, 2026
Merged
fix: thread resolved share URL into lazyBackfillAuthUserID#398tomasz-tomczyk merged 1 commit intomainfrom
tomasz-tomczyk merged 1 commit intomainfrom
Conversation
The whoami request now hits the URL passed via --share-url (or CRIT_SHARE_URL), instead of always falling back to https://crit.md. Previously, sharing to a selfhosted server caused whoami to 401 against crit.md, which silently cleared the user's cached auth token before the actual share request, breaking enforced selfhosted instances. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
❌ Your patch status has failed because the patch coverage (60.00%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #398 +/- ##
==========================================
+ Coverage 66.66% 67.09% +0.42%
==========================================
Files 19 19
Lines 8220 8221 +1
==========================================
+ Hits 5480 5516 +36
+ Misses 2314 2276 -38
- Partials 426 429 +3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
lazyBackfillAuthUserIDwas always resolving the whoami URL viaresolveShareURL("", cfg, defaultShareURL), ignoring the--share-urlflag thatrunSharehad already resolved intosf.svcURL.https://crit.mdregardless, 401'd against selfhosted-issued tokens, and the 401 handler silently cleared the cached token before the actual share request fired — breakingcrit shareagainst any enforcing selfhosted instance.serverURLintolazyBackfillAuthUserID(cfg, serverURL)and updates both call sites (runShare,runAuthLogin). Empty-string fallback preserved for back-compat.Review
Test plan
auth_test.go, two of which were verified to fail pre-fix:https://crit.md)serverURL=""go test -race -count=1 ./...→ passgolangci-lint run ./...→ 0 issues🤖 Generated with Claude Code