Skip to content

feat(agents)!: authenticate gh via 1Password#6

Merged
arv merged 3 commits into
mainfrom
arv/agents-gh-1password
Jun 15, 2026
Merged

feat(agents)!: authenticate gh via 1Password#6
arv merged 3 commits into
mainfrom
arv/agents-gh-1password

Conversation

@arv

@arv arv commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

What

Reworks how the agents feature handles GitHub auth, addressing the review concern on #2 that the old approach persisted a long-lived gh token on the host indefinitely. Bumps agents to v2.0.0.

  • Removes host-side gh credential persistence — drops the devcontainer-gh-config volume and its chown. (The Claude config volume stays.)
  • Bundles the 1Password CLI (op) — installed in install.sh straight from 1Password's official apt repo (with debsig verification).
  • Injects GH_TOKEN from 1Password per shell — a /etc/profile.d/10-gh-op-token.sh snippet runs op read on a configurable secret reference at shell start, so nothing is written to the host. No-op when unset / op unauthenticated / unresolvable, falling back to gh auth login or GITHUB_TOKEN.
  • New ghTokenSecretRef option (op://vault/item/field).
  • CI — adds .github/workflows/test.yml running devcontainer features test on PRs across a matrix of all three features (agents, docker, pnpm). The agents tests assert op --version and the gh-token profile script.
  • README updated.

Breaking change

devcontainer-gh-config is gone — existing persisted gh logins won't carry over. Configure ghTokenSecretRef + provide OP_SERVICE_ACCOUNT_TOKEN, or fall back to gh auth login. Consumers should pin :2.

Testing

devcontainer features test (now in CI) covers install + profile script. The op read → GH_TOKEN path needs a real 1Password service account, so verify it manually in a Codespace/container with OP_SERVICE_ACCOUNT_TOKEN set: bash -lc 'gh auth status'.

Why direct apt install vs a community op feature

There's no official 1Password devcontainer feature; the community ones (itsmechlark, duplocloud) are third-party. Since this change is security-motivated and the other dependsOn entries are all first-party, pulling op from 1Password's own signed apt repo is the tighter supply chain.

claude added 2 commits June 15, 2026 07:06
…edentials (v2.0.0)

Replace the host-side devcontainer-gh-config volume (which persisted a
long-lived GitHub token indefinitely) with on-demand token injection from
1Password:

- Drop the devcontainer-gh-config mount and its chown; Claude config volume
  stays persisted.
- Bundle the 1Password CLI (op) in install.sh.
- Add a ghTokenSecretRef option; a /etc/profile.d snippet resolves GH_TOKEN
  from the 1Password secret reference fresh per shell (no host persistence).
  No-op when unset/unauthenticated, falling back to gh auth login / GITHUB_TOKEN.
- Update README and tests; bump feature to v2.0.0 (removes gh persistence).
Runs 'devcontainer features test' on pull requests and pushes so the agents
feature (codex/claude/gh/op + gh-token profile script) is verified in CI,
with no local tooling required. Pins actions/checkout to a commit SHA per
org policy.
@github-actions github-actions Bot requested a review from 0xcadams June 15, 2026 07:20
@arv arv merged commit 02d75a4 into main Jun 15, 2026
6 checks passed
arv added a commit that referenced this pull request Jun 15, 2026
* docs(agents): document gh-via-1Password patterns + launchctl host setup

Re-applies the local-vs-headless split that didn't make it into #6, and
expands the host setup with launchctl coverage (the practical path for
Dock/Spotlight launches and the no-checkout Clone-in-Volume flow):

- Pattern A (local, recommended): resolve on host, forward GITHUB_TOKEN via
  remoteEnv. Documents the op-install/.zshrc/editor-launch gotchas.
- launchctl setenv for GUI launches, with relaunch / not-persistent /
  session-wide caveats and an optional login LaunchAgent.
- Pattern B (headless): in-container op read via ghTokenSecretRef + service
  account.

* docs(agents): document only the host-forward gh auth approach

Drop the two-pattern framing and the headless/service-account (Pattern B)
option; document just the local host-forward GITHUB_TOKEN approach.

---------

Co-authored-by: Claude <noreply@anthropic.com>

@0xcadams 0xcadams left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To me, this all is starting to feel like we just made local development more complex for no benefit. I've been using the 1Password integration with gh cli before the devcontainers, and it will prompt every time to use the gh token. Having it only request once feels like a downgrade, since the main threat vector is some script scraping this token out of your env. In this devcontainer it is still persisted in GH_TOKEN on startup for anyone to scrape.

If it's never in env and always requested with op read when needed, we don't have that problem.

I like having the 1Password integration and I like using gh CLI, and I like the spirit of where this is heading, it just seems like we're struggling to make devcontainers useful and secure.

cc @grgbkr

@arv

arv commented Jun 17, 2026

Copy link
Copy Markdown
Contributor Author

we're struggling to make devcontainers useful and secure.

I agree. It feels like we are learning to crawl again.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants