Skip to content

feat(signatures): Verified badges on signed commits from profile keys (P1-7, 2/2) - #348

Merged
PastaPastaPasta merged 1 commit into
masterfrom
feat/p1-7-signed-commits
Oct 2, 2026
Merged

PastaPastaPasta merged 1 commit into
masterfrom
feat/p1-7-signed-commits

Conversation

@PastaPastaPasta

Copy link
Copy Markdown
Owner

P1-7 (2/2): signed-commit badges

Shows GitHub's Verified / Unverified labels on signed commits. A commit is checked against the signing keys that identities publish in their forge-community profile.pubkeys. The contracts are unchanged: this PR uses only the existing pubkeys property.

What ships

  • Badges on the commits list, the commit page and a pull request's Commits tab. Clicking a label opens a panel:
    • Verified: the signer and the key fingerprint.
    • Unverified: the reason, which is one of: the key is on no member's profile, more than one identity lists the key, the signature doesn't match the commit, a kind Forge doesn't check (X.509, RSA, SSH ECDSA, SHA-1), or the signature can't be read.
    • Unsigned commits show nothing, as on GitHub.
  • Candidates: the repository's owner and its current members of every role, plus a PR's author on its commits.
  • Settings → Public profile → Signing keys: paste an ssh-ed25519 … line or the output of gpg --armor --export. You can list and remove keys, and the cost is confirmed before each write. The section is shown inside the existing profile form, and a key write no longer discards unsaved profile edits.
  • dg profile key add|list|remove: add with no flags publishes git's own signing key (user.signingkey, gpg.format). --ssh <file|line> and --gpg <id> work too, with gpg's subkey choice: the newest valid signing subkey, ! for exactly one key, and short key ids. dg profile show lists the keys.
  • dg verify-commit <REV>... [-R owner/name] [--author <identity>]: the same verdict as the badges, for a clone's commits. A bad signature exits with E504.

Shared rule

forge_core::rules::signature (rPGP 0.20 and ed25519-dalek) and forge-web/lib/rules/signature.ts (OpenPGP.js 6 and @noble/curves) implement the same rule:

  • Entry formats: ssh-ed25519 <b64> [comment], or gpg:<FPR> <b64 key packet>. A bare gpg:<FPR> never verifies.
  • Payload: git's parse_buffer_signed_by_header, with both gpgsig headers dropped.
  • Required: git's SSH namespace, binary OpenPGP signatures, SHA-256 or stronger.
  • Signer: exactly one candidate must list the key.

31 new vectors (pubkey_entry__*, commit_signature__*) pass in both languages. They were built from throwaway keys and commits; the public halves are in forge-contracts/fixtures/signing. Both clients also build byte-identical entries from those fixture keys (Rust and TS tests). The entry formats and rules are documented in docs/contracts/forge-v2.md (profile row) and docs/guides/identity-and-keys.md ("Signed commits and Verified badges").

Trust model (documented): Verified means "signed with a key this identity publishes". As with a key on a GitHub account, nobody proves they hold the key they list. Forge does not know commit emails. If two identities list the same key, it is ambiguous and the commit is Unverified, so a member copying someone else's key cannot take the badge from them.

Budget

The signers are read only once a page shows a signed commit: the memberships (cached, and shared with the commit page's checks) plus one profile query. Unsigned histories cost nothing. Measured on sakura (alice/p17-signed, 6 commits signed every way): the commits list costs 12 requests cold, a commit page 9.

New tests in page-budget.spec.ts, which pass against sakura:

  • sg-1: the fixture's unsigned history queries no profile.
  • sg-2: with E2E_SIGNED_REPO, the list stays ≤ 25 and reads the signers once.

Live verification on sakura

  • dg profile key add published alice's SSH key and her OpenPGP Ed25519 key, and bob's OpenPGP key (dg picked its signing subkey). A duplicate key and an RSA key were refused before anything was signed.
  • alice/p17-signed was pushed with commits of each kind: unsigned, SSH by alice, GPG by alice, GPG by bob's subkey, GPG RSA, SSH ECDSA.
  • dg verify-commit and the web gave the same verdicts:
    • Verified: SSH alice, GPG alice.
    • Unverified/unknown_key: bob (not a member) and RSA. Bob's commit is Verified with --author bob.
    • Unverified/unsupported: SSH ECDSA.
    • Nothing shown: the unsigned commit.
  • Checked at desktop and 390 px, in light and dark themes. The panel is position-fixed, so the list's overflow: hidden cannot clip it, and it flips above the label near the bottom of the viewport.
  • In the web Settings, bob added an Ed25519 SSH key (an ECDSA key was refused first) and then removed it.
  • Evidence: dash-forge-qa/evidence/p1-7/ (dg-10..12-*.txt, web/commits-badge*, web/commit-page-*, web/settings-keys-*, web/web-sig-*.log).

Review

The code-review skill ran at high effort and its findings were fixed:

  • a re-render loop in the keys section for users with no profile;
  • verdicts are now cached per signer set, so a key change re-judges commits;
  • unparseable key packets read as invalid instead of throwing, and Rust matches this for unknown algorithms;
  • one failing commit no longer marks the rest of the page as errored;
  • dg picks only valid, unexpired, unrevoked signing subkeys;
  • short key ids work, an unmatched ! and a certify-only primary are refused;
  • a gpgsig-sha256-only commit in a SHA-1 repository reads as unsigned;
  • entries are parsed once per page;
  • key removal goes through the funds check.

A simplify pass then reused useDismiss and git::config_get.

Gates: cargo fmt, clippy -D warnings, cargo test --workspace, tsc, eslint and vitest (5,501 tests) all pass.

Follows #346 (profiles, merged).

🤖 Generated with Claude Code

Signed commits (OpenPGP and SSH, as git verify-commit reads them) show GitHub's Verified / Unverified badge on the commits list, the commit page and a PR's commits. A commit is Verified when its signature checks against a key exactly one of the repository's owner and members (and a PR's author) lists in profile.pubkeys; Unverified says why. One shared rule, forge_core::rules::signature (rPGP, ed25519-dalek) and lib/rules/signature.ts (OpenPGP.js, @noble/curves), is held equal by 31 pubkey_entry / commit_signature vectors over throwaway fixture keys. Keys are published from Settings → Public profile → Signing keys or dg profile key add/list/remove; dg verify-commit gives the badges' verdict for a clone's commits. Signers are read only when a page shows a signed commit (sg-1, sg-2 budget tests).

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@coderabbitai

coderabbitai Bot commented Oct 2, 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 12 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: 44d46cd9-3594-4851-a5d6-77a66007addf

📥 Commits

Reviewing files that changed from the base of the PR and between ecf3cd6 and 6e1993f.

⛔ Files ignored due to path filters (3)
  • Cargo.lock is excluded by !**/*.lock
  • forge-contracts/fixtures/signing/e.pub is excluded by !**/*.pub
  • forge-web/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (66)
  • crates/dg/src/errors.rs
  • crates/dg/src/main.rs
  • crates/dg/src/profile.rs
  • crates/dg/src/signing.rs
  • crates/forge-core/Cargo.toml
  • crates/forge-core/src/lib.rs
  • crates/forge-core/src/rules.rs
  • crates/forge-core/src/rules/signature.rs
  • crates/forge-core/src/signing_keys.rs
  • docs/contracts/forge-v2.md
  • docs/guides/identity-and-keys.md
  • docs/guides/moving-from-github.md
  • forge-contracts/fixtures/signing/README.md
  • forge-contracts/fixtures/signing/gpg-a.asc
  • forge-contracts/fixtures/signing/gpg-b.asc
  • forge-contracts/fixtures/signing/gpg-c.asc
  • forge-contracts/vectors/commit_signature__garbage_malformed.json
  • forge-contracts/vectors/commit_signature__gpg_ambiguous.json
  • forge-contracts/vectors/commit_signature__gpg_bad_armor_malformed.json
  • forge-contracts/vectors/commit_signature__gpg_fingerprint_only_unknown.json
  • forge-contracts/vectors/commit_signature__gpg_other_hash_header_ignored.json
  • forge-contracts/vectors/commit_signature__gpg_p256_verified.json
  • forge-contracts/vectors/commit_signature__gpg_rsa_not_verifiable.json
  • forge-contracts/vectors/commit_signature__gpg_same_identity_twice.json
  • forge-contracts/vectors/commit_signature__gpg_subkey_verified.json
  • forge-contracts/vectors/commit_signature__gpg_tampered.json
  • forge-contracts/vectors/commit_signature__gpg_unknown_key.json
  • forge-contracts/vectors/commit_signature__gpg_verified.json
  • forge-contracts/vectors/commit_signature__ssh_ecdsa_unsupported.json
  • forge-contracts/vectors/commit_signature__ssh_tampered.json
  • forge-contracts/vectors/commit_signature__ssh_unknown_key.json
  • forge-contracts/vectors/commit_signature__ssh_verified.json
  • forge-contracts/vectors/commit_signature__unsigned.json
  • forge-contracts/vectors/commit_signature__x509_unsupported.json
  • forge-contracts/vectors/pubkey_entry__garbage.json
  • forge-contracts/vectors/pubkey_entry__gpg_ed25519_primary.json
  • forge-contracts/vectors/pubkey_entry__gpg_ed25519_subkey.json
  • forge-contracts/vectors/pubkey_entry__gpg_fingerprint_only.json
  • forge-contracts/vectors/pubkey_entry__gpg_lowercase_fingerprint.json
  • forge-contracts/vectors/pubkey_entry__gpg_p256.json
  • forge-contracts/vectors/pubkey_entry__gpg_rsa_not_verifiable.json
  • forge-contracts/vectors/pubkey_entry__gpg_short_fingerprint.json
  • forge-contracts/vectors/pubkey_entry__gpg_wrong_fingerprint.json
  • forge-contracts/vectors/pubkey_entry__ssh_bad_base64.json
  • forge-contracts/vectors/pubkey_entry__ssh_ecdsa_not_verifiable.json
  • forge-contracts/vectors/pubkey_entry__ssh_ed25519.json
  • forge-contracts/vectors/pubkey_entry__ssh_type_mismatch.json
  • forge-web/components/profile-settings.tsx
  • forge-web/components/repo/commit-content.tsx
  • forge-web/components/repo/commits-content.tsx
  • forge-web/components/repo/pull-content.tsx
  • forge-web/components/repo/pull-tabs.tsx
  • forge-web/components/repo/signature-badge.test.tsx
  • forge-web/components/repo/signature-badge.tsx
  • forge-web/components/signing-keys-section.tsx
  • forge-web/e2e/page-budget.spec.ts
  • forge-web/hooks/use-commit-signatures.ts
  • forge-web/lib/repo/signers.ts
  • forge-web/lib/repo/signing-keys.test.ts
  • forge-web/lib/repo/signing-keys.ts
  • forge-web/lib/rules/conformance.test.ts
  • forge-web/lib/rules/signature.ts
  • forge-web/lib/view/commit-log.ts
  • forge-web/lib/view/git-objects.ts
  • forge-web/lib/view/path-history.ts
  • forge-web/package.json
  • 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
PastaPastaPasta merged commit a259fc5 into master Oct 2, 2026
32 checks passed
@PastaPastaPasta
PastaPastaPasta deleted the feat/p1-7-signed-commits branch October 2, 2026 10:14
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