Skip to content

fix(pitchfork): trust proxy ca in windows - #3876

Merged
risu729 merged 2 commits into
agent/restore-pitchfork-schema-strictnessfrom
agent/trust-pitchfork-ca-on-windows
Jul 27, 2026
Merged

fix(pitchfork): trust proxy ca in windows#3876
risu729 merged 2 commits into
agent/restore-pitchfork-schema-strictnessfrom
agent/trust-pitchfork-ca-on-windows

Conversation

@risu729

@risu729 risu729 commented Jul 27, 2026

Copy link
Copy Markdown
Owner

Summary

  • disable Pitchfork hosts-file synchronization so Windows uses native *.localhost resolution
  • import Pitchfork’s generated local CA into the Windows current-user trusted root store during bootstrap
  • skip the import when the exact CA thumbprint is already trusted

Validation

  • mise exec -- hk check
  • Windows trusted-root store contains the Pitchfork CA thumbprint
  • Windows curl reaches https://pitchfork.localhost/ with certificate validation enabled (--ssl-no-revoke) and returns HTTP 200
  • rerunning the bootstrap import does not display another trust prompt

Stack

Stacked on #3874, which restores strict validation for the same Pitchfork config.

Summary by Sourcery

Trust Pitchfork’s local proxy CA on Windows clients and rely on native localhost resolution instead of hosts-file synchronization.

Bug Fixes:

  • Ensure Windows trusts the Pitchfork-generated proxy CA so HTTPS requests to Pitchfork domains validate correctly.

Enhancements:

  • Disable Pitchfork hosts-file synchronization to allow Windows to use its native *.localhost DNS resolution.
  • Automatically import the Pitchfork-generated CA into the Windows current-user trusted root store during bootstrap, skipping re-imports when the CA is already trusted.

@sourcery-ai

sourcery-ai Bot commented Jul 27, 2026

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Configures Pitchfork on WSL/Windows to rely on native *.localhost resolution while automatically trusting the Pitchfork-generated proxy CA in the Windows current-user root store, skipping re-import when the same certificate is already trusted.

Sequence diagram for Pitchfork CA import during bootstrap

sequenceDiagram
  participant BootstrapScript
  participant PowerShell
  participant Certutil
  participant WindowsCertStore

  BootstrapScript->>PowerShell: powershell.exe -NoProfile -Command
  PowerShell->>PowerShell: X509Certificate2.new(CertPath)
  PowerShell->>WindowsCertStore: Test-Path Cert:\CurrentUser\Root\Thumbprint
  alt [thumbprint not present]
    PowerShell->>Certutil: certutil.exe -user -f -addstore Root CertPath
    Certutil->>WindowsCertStore: add Pitchfork_CA to Root
  else [thumbprint already trusted]
    PowerShell->>PowerShell: skip import
  end
Loading

File-Level Changes

Change Details Files
Import the Pitchfork proxy CA into the Windows current-user trusted root store during bootstrap, only when not already trusted.
  • Add a bootstrap final hook that locates the Pitchfork proxy CA certificate under the WSL home state directory.
  • Convert the WSL path of the CA certificate to a Windows path using wslpath for use with Windows tools.
  • Run a PowerShell script that loads the certificate, checks for an existing certificate with the same thumbprint in Cert:\CurrentUser\Root, and conditionally imports it with certutil.exe.
  • Ensure the bootstrap fails with a clear error if certutil returns a non-zero exit code.
mise.toml
Disable Pitchfork host file synchronization so Windows uses native *.localhost resolution.
  • Update the Pitchfork proxy settings to turn off host file synchronization by setting sync_hosts to false.
wsl/home/.config/pitchfork/config.toml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

  • In the PowerShell snippet, consider quoting $CertPath when passing it to certutil.exe to avoid failures if the Windows path contains spaces (e.g. "$CertPath").
  • It may be helpful to add a small success/failure message around the CA import so that users can distinguish between a skipped import (already trusted) and a failed certutil run when troubleshooting.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In the PowerShell snippet, consider quoting `$CertPath` when passing it to `certutil.exe` to avoid failures if the Windows path contains spaces (e.g. `"$CertPath"`).
- It may be helpful to add a small success/failure message around the CA import so that users can distinguish between a skipped import (already trusted) and a failed `certutil` run when troubleshooting.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@risu729
risu729 merged commit 8703bc7 into agent/restore-pitchfork-schema-strictness Jul 27, 2026
1 check passed
@risu729
risu729 deleted the agent/trust-pitchfork-ca-on-windows branch July 27, 2026 23:51
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