Skip to content

fix(secrets): map DOCKERHUB_TOKEN to the scoped PAT, and detect registry/vault drift - #990

Merged
mlorentedev merged 2 commits into
mainfrom
fix/bug-080-dockerhub-mapping
Aug 15, 2026
Merged

fix(secrets): map DOCKERHUB_TOKEN to the scoped PAT, and detect registry/vault drift#990
mlorentedev merged 2 commits into
mainfrom
fix/bug-080-dockerhub-mapping

Conversation

@mlorentedev

Copy link
Copy Markdown
Owner

Refs #985. Spec: specs/BUG-080-registry-vault-drift/.

Not a closing keyword: the operator action that clears the current instance (renaming the vault item DockerHubdockerhub) is not in this PR — see below.

Why this was expensive

The registry names a Bitwarden item dockerhub; the vault holds DockerHub. Lookup is an exact-name match, so the entry never resolved. That would be minor if it stayed local, and it does not: dotf secrets run without --only resolves the whole registry and fails fast on the first bad entry — deliberately, so a child never launches with a partially-populated secret set (#612 A1).

So one stale name took down every unscoped run:

  • the pi shell wrapper
  • dotf spec review, whose launcher builds an unscoped run — confirmed from its own --dry-run, which prints 'dotf' 'secrets' 'run' '--' 'pi' '--print' ... with no scope

Which means the adversarial-review gate was unrunnable for every spec in every repo, and with it dotf spec archive, and with it spec-gate on any PR closing a spec's issue. Two PRs were stuck behind it. The signal was worse than useless: the launcher printed [OK] Review running detached over a process that had already died, and one session diagnosed a locked vault and was heading for a fix that would have changed nothing.

What is here

1. DOCKERHUB_TOKENfield: PAT. Found while reading the item that would not resolve: the entry pointed at the account password while a scoped personal access token sat beside it in the same item. Verified live — both return HTTP 200 against the Hub API, which is exactly why it never surfaced. A blast-radius fix, not the repair of a broken credential, and the registry now carries that evidence so nobody reverts it as a regression.

2. A doctor section asserting the registry→vault mapping. For every backend: bw entry, the item it names must exist. Name-only — it lists item names through the daemon and compares sets, never reading a field, resolving a secret, or seeing a value. It reports the missing item, every secret id that named it, and what breaks, because the symptom never points back here.

Evidence

Observed failing against the real vault, not only a fixture:

[Bitwarden mapping (registry -> vault)]
  [FAIL] dockerhub: no such item in the vault, named by DOCKERHUB_TOKEN, DOCKERHUB_USERNAME — every `dotf secrets run` without --only fails on it, including `dotf spec review`
$ dotf secrets run -- true
Error: bw resolve dockerhub/password: bw item not found: bw serve item "dockerhub": not found
$ dotf secrets run --only NAN_API_KEY -- true ; echo $?
0

go build, go vet, go test ./... all green.

What is deliberately NOT here

  • The vault rename. It was authorised, and I stopped anyway: the CR overlay's precondition could not be met, because dotf secrets backup fails with Vault is lockedbw export uses the CLI's own session while the daemon holds a separate unlocked one. A live password vault does not get mutated without a working escrow, for a rename that takes 30 seconds in the UI. That tooling gap is a finding of its own.
  • Making unscoped run tolerant of a secret the caller never asked for. The deeper fix, and a deliberate reversal of a settled design — a decision, not a bug fix. Until it is taken the next drift breaks the same things; this makes the drift visible before it does.
  • The launcher announcing success over a dead child (BUG-081: dotf spec review reports [OK] Review running detached for a launch that died instantly #989), and the Dotfiles/ folder rename (refactor(secrets): drop the Dotfiles/ prefix from the folder taxonomy #982, another session).

@coderabbitai

coderabbitai Bot commented Aug 15, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@mlorentedev, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 14 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 45c9e464-4ab2-446d-91d6-50abf97ae3fa

📥 Commits

Reviewing files that changed from the base of the PR and between 62d2e84 and c100c54.

📒 Files selected for processing (10)
  • cli/internal/doctor/checks_bw_mapping.go
  • cli/internal/doctor/checks_bw_mapping_test.go
  • cli/internal/doctor/doctor.go
  • cli/internal/doctor/system.go
  • cli/internal/doctor/testhelpers_test.go
  • cli/internal/secrets/bwserve.go
  • secrets/registry.yaml
  • specs/BUG-080-registry-vault-drift/proposal.md
  • specs/BUG-080-registry-vault-drift/tasks.md
  • specs/BUG-080-registry-vault-drift/verification.md

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@mlorentedev
mlorentedev force-pushed the fix/bug-080-dockerhub-mapping branch from 5c73d51 to 74cc65d Compare August 15, 2026 07:44
…try/vault drift

The registry names a Bitwarden item `dockerhub`; the vault holds `DockerHub`.
Item lookup is an exact-name match, so the entry never resolved — and because
`dotf secrets run` without `--only` resolves the whole registry and fails fast on
the first bad entry, one stale name took down every unscoped run. That includes
`dotf spec review`, whose launcher builds one, so the adversarial-review gate was
unrunnable for every spec in every repo and two PRs sat blocked behind it. The
only symptom was a review that produced an empty transcript.

Reading the item that would not resolve turned up a second defect: the entry
mapped `field: password` — the account password — while a scoped PAT sat beside
it. Both authenticate with HTTP 200, which is why it stayed invisible. Now mapped
to the PAT, with the evidence recorded so it is not reverted as a regression.

The guard is a doctor section comparing the items the registry declares against
the names the vault holds. Name-only: no field is read, no secret resolved, no
value seen. It reports the missing item, every secret id naming it, and what
breaks — because the symptom never points back here. Observed failing against the
real vault, not only a fixture.

The vault-side rename that clears the current instance is an operator action and
is deliberately not in this PR: `dotf secrets backup` cannot run (bw export uses
the locked CLI session, not the unlocked daemon), and a live password vault does
not get mutated without a working escrow.

Refs #985
@mlorentedev
mlorentedev force-pushed the fix/bug-080-dockerhub-mapping branch from 74cc65d to 4d9ef0b Compare August 15, 2026 08:02
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.

1 participant