Repository navigation
feat(locallibrary): ask a service for more scope when a plugin needs it, and handle a refused token - #339
Merged
Conversation
…ing the refresh token
…, saying which it declined
… a plugin more scopes
…read insufficient_scope
3 tasks done
SizeCompared with main. KiB are 1,024 bytes.
|
Rust coverageFrom run 130. Both are held to the thresholds in .cargo/config.toml.
|
bnb
previously approved these changes
Oct 30, 2026
rustdoc denies the private accounts::ready link under -D warnings; link Plugins::unready instead.
# Conflicts: # apps/locallibrary/src/account_cmd/access.rs # apps/locallibrary/src/account_cmd/accounts.rs # crates/locallibrary/src/plugin/net.rs
…ccount-escalation.md
bnb
previously approved these changes
Nov 1, 2026
bnb
approved these changes
Nov 1, 2026
… says its token is invalid
# Conflicts: # crates/locallibrary/src/plugin/accounts/access.rs # crates/locallibrary/src/plugin/accounts/shared.rs
bnb
previously approved these changes
Nov 1, 2026
bnb
previously approved these changes
Nov 1, 2026
botandbang
dismissed
bnb’s stale review
November 1, 2026 22:43
The merge-base changed after approval.
Contributor
Author
|
Closing and reopening so CI runs against current main (with #353's CodeQL fix). Branch unchanged. |
bnb
previously approved these changes
Nov 1, 2026
prepare used to check where a plugin's request goes, fill in its secrets and accounts' tokens, and return the address with the query's filled in. Now address() parses the address and checks the plugin may go there, with no secret in it, and prepare returns what's sent: its headers, body and accounts, and its query with everything filled in, kept apart. follow sends the first hop to the address without its query and adds the filled pairs with RequestBuilder::query, which encodes them the same way, so the first request on the wire doesn't change. The address follow keeps and resolves each redirect against never holds a token, so a redirect back to the same address (an empty or fragment-only Location) no longer sends one again. Mixcloud still takes its token in the query, since its API reads it nowhere else (https://www.mixcloud.com/developers/).
bnb
approved these changes
Nov 2, 2026
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.
What and why
Stacked on #335. With accounts shared between plugins, one plugin can need more of an account than another already got, and a service can refuse a token mid-publish. This makes locallibrary handle both instead of each plugin.
Added:
params, sent with every sign-in; google-account sendsaccess_type=offlineso a web-type client gets a refresh token too. Onlylogin_hint,prompt,hdandaccess_typeare allowed, and a key can't be in bothparamsandone_account/another_account.one_account's params, and keeps the old refresh token when the service sends none. A signed-out account that still has accesses can be signed in again by name.plugin access --givegives them. A sign-in again that comes back as a different person keeps that account but gives the plugin no access.accounts.access.giveandplugin access PLUGIN --give ACCOUNT --scope S.invalid_token. A 401/403 withWWW-Authenticate: ... error="insufficient_scope"or Google'sACCESS_TOKEN_SCOPE_INSUFFICIENTbody becomes kindscopewithneeds, and the account stops counting those scopes as granted.Changed: youtube, mixcloud and soundcloud no longer handle a refused token themselves; a 401 that still reaches them is a plain refusal.
How it was tested
invalid_token, header and body scope refusals, plain 403, 200), and the challenge parser. Each new test was broken once to see it fail. Tests use a mock account plugin and mock OAuth service only.docs/rpccurrent, full nextest 4087/4088 (the one failure is fixed by test(locallibrary): leave blank names out of the edit model's playlist lookups #334). Hegel coverage 95.56 / 94.05 / 93.64.Checklist
apps/locallibrary/CHANGELOG.mdhas a line under Unreleaseddocs/and--helpstill say what the code does (apps/locallibrary/docs/rpc/too)