Skip to content

fix(dg): keep the encryption key beside the limited key, describe runner keys, per-file passphrases - #273

Merged
PastaPastaPasta merged 2 commits into
masterfrom
fix/qw2-cli-keys
Sep 30, 2026
Merged

PastaPastaPasta merged 2 commits into
masterfrom
fix/qw2-cli-keys

Conversation

@PastaPastaPasta

Copy link
Copy Markdown
Owner

QA wave 2 (bonsia), stream cli-keys-args, batch 4: the CLI key model.

Fixes

  • QW2-004: private repos needed the master key on disk.
    • What gets stored: dg auth login (from the file or the words), dg auth new and dg auth keys add now keep the identity's ENCRYPTION key(s) next to the limited signing key. What's stored is a bridge-format identity holding exactly the limited key and those keys, with no master key and no recovery words. So private repos work with a spend-capped key, as they do with the web app's "Enable private repos".
      • Keys are picked by EncryptionKeys::held: only keys the source holds, or that its words derive, which match the identity on chain.
      • keys add also keeps the ones the replaced key held.
    • Opting out: --signing-only stores the signing key alone. So does --insecure-plaintext, because the encryption key is never written in the clear.
    • Visibility:
      • dg auth status has a Private: line, checked against the chain.
      • doctor's keys row reports the same.
      • login, new and keys add print which encryption key was kept.
    • Migration: a key stored by an older dg gets the exact command to fix it, dg auth login <file> --replace <id>, so no key is left live on chain with nothing holding it. An identity with no encryption key is pointed at dg auth keys add --encryption.
    • Error text: E306/E301 and the docs point there too, not at --full-key.
  • QW2-005: runner keys were described as "unlimited". dg auth status and dg doctor now describe a key bound to one document type as #7 bound to checkRun documents only (a CI runner key) — 0.5 of 0.5 DASH left, expires in 365 day(s). Before, it read as "unlimited" or as a general "HIGH/CRITICAL auth key for writes". doctor also fails a key that isn't live on the identity, or whose budget is spent or which has expired.
  • QW2-022: the runner file couldn't have its own passphrase. dg ci runner new --runner <file> reads that file's passphrase from DASH_FORGE_RUNNER_PASSPHRASE, falling back to DASH_FORGE_PASSPHRASE. A sealed file that doesn't open now fails with E303 naming the file and the variable the passphrase came from, instead of E204 naming neither. ci.md documents the scripted recipe.
  • QW-034 (residue): dg webhook list opened the key. It's now a read that opens no key for a public repo, like the other lists.

Not touched

The recovery-word and secret output (QW2-001, a separate hotfix).

Security note

The encryption key now sits where the limited key is kept: the OS keychain, or a passphrase-sealed file. The keychain paragraph in identity-and-keys.md says so. It's a read key with no budget, and it opens old private content, which is why --signing-only exists and why it's never stored unencrypted. This is the same tradeoff as a scoped token or deploy key on GitHub, and it's what the QA expected ("a spend-capped signing key plus the encryption key only").

Verification

  • cargo fmt --check, clippy --workspace --all-targets -D warnings and cargo test --workspace all pass. New tests:
    • held keys to file entries and back (forge-core)
    • the stored text holds no master key or words
    • the runner-key line, and spent_or_expired
    • the Private: line cases
    • E303 names the file and the variable
  • Live on bonsia, in scratch config dirs (no keychain, sealed files) with test identities. No key material is in the logs. Evidence is in dash-forge-qa/evidence/qa-wave-bonsia-2/fixes/cli-keys-args/:

This is CLI-only, with no web UI change.

🤖 Generated with Claude Code

@coderabbitai

coderabbitai Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

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

Next included review available in 6 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: bac35892-cddc-4e9f-acdf-ec608ae8b67e

📥 Commits

Reviewing files that changed from the base of the PR and between 2e1fdc0 and 1bc963a.

📒 Files selected for processing (16)
  • crates/dg/src/auth/keys.rs
  • crates/dg/src/auth/mod.rs
  • crates/dg/src/auth/new.rs
  • crates/dg/src/ci.rs
  • crates/dg/src/doctor.rs
  • crates/dg/src/webhook.rs
  • crates/forge-core/src/keyring.rs
  • crates/forge-core/src/keystore.rs
  • crates/forge-core/src/sealed.rs
  • crates/forge-core/src/user_error.rs
  • crates/git-remote-dash/src/helper.rs
  • docs/errors.md
  • docs/guides/ci.md
  • docs/guides/collaborating.md
  • docs/guides/identity-and-keys.md
  • docs/guides/quick-start.md
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


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.

PastaPastaPasta and others added 2 commits September 30, 2026 16:30
…ner keys, per-file passphrases

QW2-004: dg auth login, dg auth new and dg auth keys add store the identity's ENCRYPTION keys beside the limited signing key (a bridge identity holding exactly those, no master key or words), so private repositories work without the master key on disk, as the web's Enable private repos does. --signing-only opts out. auth status shows a Private: line, doctor says it too, and E306/E301 now point at signing in again instead of --full-key.

QW2-005: auth status and doctor describe a key bound to one document type (a CI runner key) as such, with its budget and expiry, instead of unlimited / a general write key; doctor fails a key that is not live on the identity.

QW2-022: dg ci runner new reads the --runner file's passphrase from DASH_FORGE_RUNNER_PASSPHRASE (else DASH_FORGE_PASSPHRASE); a sealed file that does not open is E303 naming the file and where the passphrase came from, not an E204.

QW-034: dg webhook list is a read that opens no key for a public repository.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Callers pick the encryption keys once (encryption_to_store) and pass them to register_and_store, so what is printed is what is stored and the identity is not fetched again. dg auth keys add keeps the encryption keys the replaced key holds. Nothing is stored beside a key written in the clear (--insecure-plaintext). The Private: line and the doctor keys row read the keys against the chain, point an identity with none at dg auth keys add --encryption, and name --replace <key id> so signing in again leaves no orphaned key. doctor fails a spent or expired key. A sealed file's non-passphrase errors keep their type, and the variable in use is looked up in one place.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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