-
Notifications
You must be signed in to change notification settings - Fork 8
fix: address all Copilot feedback from PR #1236 #1237
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
54ac90d
9bf0e76
c930169
fe97735
cc7cf36
feb8e32
b0460df
588d728
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,381 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||
| # Agent GPG Commit Signing | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| This guide covers GPG commit signing for Flowspec agents, enabling cryptographic verification of agent-generated commits. | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| ## Overview | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| Flowspec agents can generate their own GPG keys and sign commits to provide: | ||||||||||||||||||||||||||||||||||||||||||||||||
| - **Cryptographic verification** of agent authorship | ||||||||||||||||||||||||||||||||||||||||||||||||
| - **Non-repudiation** - proof that commits came from the agent | ||||||||||||||||||||||||||||||||||||||||||||||||
| - **Trust chains** - link agent commits to their originating workflow | ||||||||||||||||||||||||||||||||||||||||||||||||
| - **Audit trails** - track which agent made which changes | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| ## Quick Start | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| ### 1. Set Up GPG Signing | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| ```bash | ||||||||||||||||||||||||||||||||||||||||||||||||
| # Generate agent GPG key and configure git | ||||||||||||||||||||||||||||||||||||||||||||||||
| flowspec gpg setup | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| # Output: | ||||||||||||||||||||||||||||||||||||||||||||||||
| # ✓ GPG key generated | ||||||||||||||||||||||||||||||||||||||||||||||||
| # ✓ Git configured for signing | ||||||||||||||||||||||||||||||||||||||||||||||||
| # | ||||||||||||||||||||||||||||||||||||||||||||||||
| # Fingerprint: A1B2C3D4E5F6A7B8C9D0E1F2A3B4C5D6E7F8A9B0 | ||||||||||||||||||||||||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| ### 2. Verify Status | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| ```bash | ||||||||||||||||||||||||||||||||||||||||||||||||
| # Check GPG signing status | ||||||||||||||||||||||||||||||||||||||||||||||||
| flowspec gpg status | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| # Output: | ||||||||||||||||||||||||||||||||||||||||||||||||
| # ┌─ Agent GPG Signing Status ─┐ | ||||||||||||||||||||||||||||||||||||||||||||||||
| # │ Status Configured │ | ||||||||||||||||||||||||||||||||||||||||||||||||
| # │ Fingerprint A1B2C3... │ | ||||||||||||||||||||||||||||||||||||||||||||||||
| # │ Git Signing Enabled │ | ||||||||||||||||||||||||||||||||||||||||||||||||
| # └─────────────────────────────┘ | ||||||||||||||||||||||||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| ### 3. Make Signed Commits | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| Once configured, all commits in the repository will be automatically signed by the agent: | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| ```bash | ||||||||||||||||||||||||||||||||||||||||||||||||
| git commit -m "feat: add new feature" | ||||||||||||||||||||||||||||||||||||||||||||||||
| # Commit is automatically signed with agent's GPG key | ||||||||||||||||||||||||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| ## Commands | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| ### `flowspec gpg setup` | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| Generate a new GPG key and configure git for commit signing. | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| ```bash | ||||||||||||||||||||||||||||||||||||||||||||||||
| # Set up in current repository | ||||||||||||||||||||||||||||||||||||||||||||||||
| flowspec gpg setup | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| # Set up in specific repository | ||||||||||||||||||||||||||||||||||||||||||||||||
| flowspec gpg setup --project-root /path/to/repo | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| # Force key regeneration | ||||||||||||||||||||||||||||||||||||||||||||||||
| flowspec gpg setup --force | ||||||||||||||||||||||||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| **What it does:** | ||||||||||||||||||||||||||||||||||||||||||||||||
| 1. Generates a 4096-bit RSA GPG key for "Flowspec Agent <agent@flowspec.local>" | ||||||||||||||||||||||||||||||||||||||||||||||||
| 2. Stores the key fingerprint in the system keyring | ||||||||||||||||||||||||||||||||||||||||||||||||
| 3. Configures local git settings: | ||||||||||||||||||||||||||||||||||||||||||||||||
| - `user.signingkey`: agent's GPG fingerprint | ||||||||||||||||||||||||||||||||||||||||||||||||
| - `commit.gpgsign`: true | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| ### `flowspec gpg status` | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| Show current GPG signing configuration and status. | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| ```bash | ||||||||||||||||||||||||||||||||||||||||||||||||
| # Check status in current repository | ||||||||||||||||||||||||||||||||||||||||||||||||
| flowspec gpg status | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| # Check status with detailed key information | ||||||||||||||||||||||||||||||||||||||||||||||||
| flowspec gpg status --verbose | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| # Check status in specific repository | ||||||||||||||||||||||||||||||||||||||||||||||||
| flowspec gpg status --project-root /path/to/repo | ||||||||||||||||||||||||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| **Output includes:** | ||||||||||||||||||||||||||||||||||||||||||||||||
| - Configuration status (configured/not configured) | ||||||||||||||||||||||||||||||||||||||||||||||||
| - GPG key fingerprint | ||||||||||||||||||||||||||||||||||||||||||||||||
| - Git signing status (enabled/disabled) | ||||||||||||||||||||||||||||||||||||||||||||||||
| - Key creation date (with `--verbose`) | ||||||||||||||||||||||||||||||||||||||||||||||||
| - Key identity (with `--verbose`) | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| ### `flowspec gpg rotate` | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| Rotate the agent's GPG key (delete old key, generate new key). | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| ```bash | ||||||||||||||||||||||||||||||||||||||||||||||||
| # Rotate key (with confirmation prompt) | ||||||||||||||||||||||||||||||||||||||||||||||||
| flowspec gpg rotate | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| # Rotate key without confirmation | ||||||||||||||||||||||||||||||||||||||||||||||||
| flowspec gpg rotate --yes | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| # Rotate key for specific repository | ||||||||||||||||||||||||||||||||||||||||||||||||
| flowspec gpg rotate --project-root /path/to/repo | ||||||||||||||||||||||||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| **When to rotate:** | ||||||||||||||||||||||||||||||||||||||||||||||||
| - Regular security practice (e.g., annually) | ||||||||||||||||||||||||||||||||||||||||||||||||
| - Key compromise or suspected compromise | ||||||||||||||||||||||||||||||||||||||||||||||||
| - Agent role change or re-provisioning | ||||||||||||||||||||||||||||||||||||||||||||||||
| - Compliance requirements | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| **Warning:** Rotating a key does not re-sign historical commits. Old commits will still reference the old key fingerprint. | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| ## Key Management | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| ### Key Storage | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| - **GPG Keychain**: Keys are stored in the user's GPG keychain (`~/.gnupg/`) | ||||||||||||||||||||||||||||||||||||||||||||||||
| - **Fingerprint**: The key fingerprint is stored in the system keyring for quick retrieval | ||||||||||||||||||||||||||||||||||||||||||||||||
| - **Service Name**: `flowspec-agent-gpg` | ||||||||||||||||||||||||||||||||||||||||||||||||
| - **Username**: `agent-key-fingerprint` | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| ### Key Properties | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||||||||||||||||||||||||
| Name: Flowspec Agent | ||||||||||||||||||||||||||||||||||||||||||||||||
| Email: agent@flowspec.local | ||||||||||||||||||||||||||||||||||||||||||||||||
| Type: RSA | ||||||||||||||||||||||||||||||||||||||||||||||||
| Length: 4096 bits | ||||||||||||||||||||||||||||||||||||||||||||||||
| Expiration: None (does not expire) | ||||||||||||||||||||||||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| ### Security Considerations | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| 1. **No Passphrase**: Agent keys are generated without a passphrase for automated signing | ||||||||||||||||||||||||||||||||||||||||||||||||
| 2. **Local Storage**: Keys are stored locally on the agent's system | ||||||||||||||||||||||||||||||||||||||||||||||||
| 3. **Per-User**: Each user account has its own agent key | ||||||||||||||||||||||||||||||||||||||||||||||||
| 4. **Repository Config**: Git signing is configured per-repository (local config) | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| ## Git Configuration | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| GPG signing modifies local git configuration: | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| ```bash | ||||||||||||||||||||||||||||||||||||||||||||||||
| # View current configuration | ||||||||||||||||||||||||||||||||||||||||||||||||
| git config --local user.signingkey | ||||||||||||||||||||||||||||||||||||||||||||||||
| git config --local commit.gpgsign | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| # Manual configuration (not recommended - use 'flowspec gpg setup') | ||||||||||||||||||||||||||||||||||||||||||||||||
| git config --local user.signingkey A1B2C3D4E5F6A7B8C9D0E1F2A3B4C5D6E7F8A9B0 | ||||||||||||||||||||||||||||||||||||||||||||||||
| git config --local commit.gpgsign true | ||||||||||||||||||||||||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| ## Telemetry Integration | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| When GPG signing is active, the agent's key fingerprint is included in telemetry output: | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| ```bash | ||||||||||||||||||||||||||||||||||||||||||||||||
| # View telemetry status with GPG info | ||||||||||||||||||||||||||||||||||||||||||||||||
| flowspec telemetry status | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| # Output includes: | ||||||||||||||||||||||||||||||||||||||||||||||||
| # ┌─ Telemetry Status ──────────┐ | ||||||||||||||||||||||||||||||||||||||||||||||||
| # │ Status Enabled │ | ||||||||||||||||||||||||||||||||||||||||||||||||
| # │ Events 1,234 │ | ||||||||||||||||||||||||||||||||||||||||||||||||
| # │ GPG Signing Active │ | ||||||||||||||||||||||||||||||||||||||||||||||||
| # │ GPG Fingerprint A1B2C3... │ | ||||||||||||||||||||||||||||||||||||||||||||||||
| # └──────────────────────────────┘ | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+162
to
+174
|
||||||||||||||||||||||||||||||||||||||||||||||||
| When GPG signing is active, the agent's key fingerprint is included in telemetry output: | |
| ```bash | |
| # View telemetry status with GPG info | |
| flowspec telemetry status | |
| # Output includes: | |
| # ┌─ Telemetry Status ──────────┐ | |
| # │ Status Enabled │ | |
| # │ Events 1,234 │ | |
| # │ GPG Signing Active │ | |
| # │ GPG Fingerprint A1B2C3... │ | |
| # └──────────────────────────────┘ | |
| GPG signing improves commit verification and auditability for agent-generated changes. | |
| `flowspec telemetry status` does not currently display GPG signing state or key fingerprint information, so use the GPG-specific commands to inspect signing configuration: | |
| ```bash | |
| # Check GPG signing status | |
| flowspec gpg status | |
| # Export the public key when needed | |
| flowspec gpg export --public |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This guide assumes
flowspec gpg setup/status/rotateare available, but the PR doesn’t appear to register thegpgsubcommand with the main CLI. Untilgpg_appis added to the root Typer app, these documented commands will fail with “No such command”. Either wire the subcommand into the CLI or gate this guide behind the release that includes the wiring.