Skip to content

fix(github-copilot): device login no longer leaves plaintext tokens - #133033

Merged
fuller-stack-dev merged 1 commit into
mainfrom
fix/copilot-device-token-secretref
Aug 30, 2026
Merged

fuller-stack-dev merged 1 commit into
mainfrom
fix/copilot-device-token-secretref

Conversation

@fuller-stack-dev

Copy link
Copy Markdown
Member

Related: #106724

What Problem This Solves

Fixes an issue where users completing GitHub Copilot device login would have the resulting GitHub token stored inline in the agent auth profile. openclaw secrets audit --check then correctly reported the durable plaintext credential, even though noninteractive onboarding could already persist an environment-backed tokenRef.

Why This Change Was Made

GitHub Copilot device login now requests host-owned protected persistence by default. OpenClaw keeps the token inline only while staged validation runs, then writes it to the built-in local secret store and persists a stable tokenRef at the final auth commit boundary. Public and enterprise login use the same path.

An explicit --secret-input-mode plaintext choice remains supported and visible to the audit. If the protected store cannot be written, login fails with repair guidance before replacing the previous auth profile; it never silently falls back to plaintext. Existing ref-backed profiles and noninteractive onboarding are unchanged.

The built-in store requires no external secret-provider configuration. It is write-only through OpenClaw's user-facing secret APIs, but it is not encrypted at rest and continues to rely on state-directory permissions.

User Impact

Interactive GitHub Copilot login no longer leaves a durable access token inline by default. Existing installations without an external secret provider still get protected-store persistence automatically, while operators who explicitly select plaintext mode keep the previous compatibility behavior and audit warning.

Evidence

  • Red on unmodified production at c40316696968e53571c1432026fe8f281e58c000: the focused device-token persistence test expected a protected-store write and observed zero writes; the synthetic auth profile produced PLAINTEXT_FOUND at profiles.github-copilot:github.token.
  • Green on the proposed patch: the same focused reproduction passes and the SQLite integration proves the auth profile contains only a resolvable store ref, the backing value exists, and the plaintext audit finding is absent.
  • Negative control: an unavailable protected store reports actionable state-directory repair guidance, preserves the prior ref-backed profile, and writes no inline fallback.
  • Explicit plaintext control: the profile remains inline and openclaw secrets audit --check continues to report it.
  • Public/enterprise device-login guards, noninteractive onboarding, auth-choice, agent-add, system-agent inference, plugin contracts, typechecks, lint, docs formatting, database/schema guards, and plugin-boundary checks pass.
  • Source-blind behavior validation passed all five contract checks. No live credentials or existing installations were accessed.

Focused command:

node scripts/run-vitest.mjs src/commands/models/auth.test.ts -t "persists a provider-minted Copilot token through the protected store"

Production LOC: +374/-28 (net +346) | Tests/test support: +207/-2 | Docs: +49/-10. The production growth establishes the generic provider-auth storage and compensation boundary; it adds no config or schema surface.

@clawsweeper

clawsweeper Bot commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation commands Command implementations extensions: github-copilot size: L maintainer Maintainer-authored PR labels Aug 30, 2026
@fuller-stack-dev
fuller-stack-dev merged commit d4ad866 into main Aug 30, 2026
242 checks passed
@fuller-stack-dev
fuller-stack-dev deleted the fix/copilot-device-token-secretref branch August 30, 2026 02:55
@fuller-stack-dev

Copy link
Copy Markdown
Member Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commands Command implementations docs Improvements or additions to documentation extensions: github-copilot maintainer Maintainer-authored PR size: L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant