CodexBar icon indicating copy to clipboard operation
CodexBar copied to clipboard

User plugins: allow Aside cookie import for a custom Qiniu quota plugin

Open bbnotcode opened this issue 1 month ago • 2 comments

Request

Please let user-installed provider plugins import cookies from supported browsers such as Aside, rather than restricting them to Chrome. An explicit browser/profile selection would also work.

My use case is a custom Qiniu Cloud Conatus quota plugin. I use Aside for the Qiniu console and want to keep standard CodexBar/Homebrew updates, without maintaining a locally rebuilt app.

Current behavior

  • The plugin originally used a manually pasted Qiniu console Cookie.
  • When that session became invalid, the official read-only quota endpoint returned HTTP 401.
  • Signing back into Qiniu in Aside restored HTTP 200 in the browser, but the plugin needed its copied Cookie updated separately.
  • Switching the plugin to ctx.browser.cookieHeader("portal.qiniu.com") cannot reuse Aside through the current user-plugin browser policy, even though SweetCookieKit already supports Aside.

This does not establish that every new login invalidates older sessions; the verified issue is the expired copied session and the inability to follow the current Aside session automatically.

Source checked

In 0.81.0 (ee890b5), and in the current default-branch file checked when filing:

  • BrowserCookieImportSupport.importOrder(for:) falls back to [.chrome] when there is no built-in provider.
  • User plugins reach this path through UserProviderPluginCookieBroker.
  • The plugin documentation also describes Chrome-only imports for user plugins.

A local diagnostic using the existing Aside importer and a modified user-plugin resolver successfully fetched the Qiniu quota through the native plugin runtime. No modified CodexBar app has been installed.

Expected behavior

For this Qiniu plugin, after I sign in again in Aside, refreshing CodexBar should use the current browser session without requiring another manual Cookie copy. Please retain declared-domain approval, manual Cookie fallback, and the existing safeguards against background Keychain prompts.

This request is for the cookie access needed by a custom Qiniu quota plugin, not for a new bundled Qiniu provider or unrelated provider integrations.

Related: #4215 covered adding missing browsers to the underlying catalog; this request concerns the remaining Chrome-only restriction for user-installed plugins.

AI-assisted investigation and drafting; no credentials or account identifiers are included.

bbnotcode avatar Oct 26 '26 16:10 bbnotcode

Codex review: this still needs some work.

Summary Keep open: current main still restricts user-plugin cookie imports to Chrome, and the merged Aside catalog work does not provide the requested plugin capability.

Reproducibility: Source establishes that an approved user-plugin request for portal.qiniu.com cannot reach Aside through the current resolver; no live browser, Keychain or quota request was run.

Maintainer decision needed

  • Question: Should user-plugin cookie approval authorize the shared browser order, or require an explicit browser/profile choice?
  • Recommendation: Adopt shared browser traversal: Use the existing browser order with explicit approval guidance and lazy candidate validation, retaining all access-gate guarantees.
  • Why: Current docs and tests deliberately retain Chrome-only imports, while the newer shared-browser guidance does not settle user-plugin consent or candidate validation.

Next step Decide the browser-consent and session-selection contract for user plugins before implementing Aside access.

Security Needs attention: Broader browser access changes which session credentials approved user plugins can receive, requiring an explicit consent boundary.

Review details

Best possible solution:

Provide approved user plugins a supported browser-session path that preserves domain approval, manual fallback and the shared cookie-access safeguards.

Do we have a high-confidence way to reproduce the issue?

Source establishes that an approved user-plugin request for portal.qiniu.com cannot reach Aside through the current resolver; no live browser, Keychain or quota request was run.

Is this the best way to solve the issue?

Reusing the shared importer is appropriate, but a fallback-list edit alone cannot provide browser traversal and validated session recovery.

AGENTS.md: found and applied where relevant.

Remaining risk / open question:

  • Existing plugin approval records bind domains and capabilities but do not identify browser sources, so the consent contract for broader access remains undecided.
  • Changing the fallback list alone is insufficient: the user-plugin resolver reads batch zero only, and its single-header interface does not validate later browser sessions after an HTTP 401.
  • The reported successful modified-runtime Qiniu diagnostic has no inspectable artifact here; real Aside-to-Qiniu behavior remains unverified.

Codex review notes: model internal, reasoning medium; reviewed against 6070b29a1a5d.

Label changes

Label changes:

  • add P2: A bounded plugin capability is missing, with manual Cookie copying available as a workaround.
  • add impact:auth-provider: The plugin cannot acquire the current provider session from the user's supported browser.
  • add impact:ux-friction: Session expiry requires another manual Cookie copy despite a valid Aside login.
  • add issue-rating: 🦞 diamond lobster: Current issue advisory state selects this label.
  • add clawsweeper:source-repro: Current issue advisory state selects this label.
  • add clawsweeper:no-new-fix-pr: Current issue advisory state selects this label.
  • add clawsweeper:needs-product-decision: Current issue advisory state selects this label.
  • add clawsweeper:needs-security-review: Current issue advisory state selects this label.

Label justifications:

  • P2: A bounded plugin capability is missing, with manual Cookie copying available as a workaround.
  • impact:auth-provider: The plugin cannot acquire the current provider session from the user's supported browser.
  • impact:ux-friction: Session expiry requires another manual Cookie copy despite a valid Aside login.
Evidence reviewed

Security concerns:

  • [low] Define approval scope before widening browser access — Sources/CodexBarCore/Plugins/ProviderPluginCookieBroker.swift:529 User plugins receive raw cookie headers, while existing approvals specify domains and capabilities rather than browsers; decide whether existing consent covers additional browser stores and preserve declared-domain enforcement and prompt limits. Confidence: 0.96

What I checked:

  • Current plugin restriction: The user-plugin resolver omits the built-in provider argument and requests only the default batch; importOrder falls back to Chrome when that argument is nil. (Sources/CodexBarCore/Plugins/ProviderPluginCookieBroker.swift:529, 6070b29a1a5d)
  • Documented and tested contract: Plugin documentation explicitly describes Chrome-only user imports, and BrowserCookieImportSupportTests asserts that the nil-provider browser label is Chrome; this is a capability extension rather than a demonstrated violation of the documented contract. (docs/plugins.md:284, 6070b29a1a5d)
  • Aside support exists in the pinned dependency: CodexBar directly invokes BrowserCookieClient and pins SweetCookieKit 0.5.9 at this revision, establishing the dependency contract; its catalog includes Aside, its profile directory and Safe Storage labels, and the default order includes it. The dependency AGENTS.md was read. (Sources/SweetCookieKit/BrowserCatalog.swift, 5b0aead7093a)
  • Related work does not resolve this request: The owner discussion at https://github.com/steipete/CodexBar/issues/4215#issuecomment-5964997754 distinguishes catalog support from provider restrictions; https://github.com/steipete/CodexBar/pull/4235 merged catalog adoption and widened Muse, without enabling other browsers for user plugins. The downloaded screenshot shows the older Muse guidance, not a Qiniu plugin run.
  • Historical plugin boundary: The merged introduction of user-installed plugins explicitly implemented Chrome-only imports and documented that restriction; subsequent shared-browser work in https://github.com/steipete/CodexBar/pull/4498 retained the nil-provider Chrome fallback. (Sources/CodexBarCore/Plugins/ProviderPluginCookieBroker.swift:524, a82f509ea8e7)
  • Existing safety boundaries: The manifest checks capability and declared domain before cookie resolution; browser reads use the access gate, which enforces background no-UI behavior, denial cooldowns and a shared interactive-read allowance. (Sources/CodexBarCore/BrowserCookieAccessGate.swift:229, 6070b29a1a5d)
How this review workflow works
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge; those execution lanes are retired.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

Reviewed October 26, 2026, 12:37 PM ET / 16:37 UTC.

clawsweeper[bot] avatar Oct 26 '26 16:10 clawsweeper[bot]

Fixed in #4858 (4d9400fb610f); it will ship in the next release. Thanks for the report!

steipete avatar Oct 31 '26 02:10 steipete