Skip to content

improve/simplify trusted dir handling - #2

Merged
MichaelMure merged 1 commit into
masterfrom
trusted-dit
Oct 9, 2026
Merged

MichaelMure merged 1 commit into
masterfrom
trusted-dit

Conversation

@MichaelMure

@MichaelMure MichaelMure commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5 Tier: plus

The PR appears safe to merge; both numbered Windows findings are fixed, and no new actionable issue was found.

Summary

Moves repository trust checks into Discover, which now accepts a working-tree path and returns ErrUntrusted when ownership and protected safe.directory settings do not allow it.

  • Resolves Windows directory links before checking their owners.
  • Uses an impersonation token for linked administrator-token checks.
  • Adds Git comparison tests and root-run ownership tests in CI.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A["Discover(dir)"] --> B["Find the git directory and paths to check"]
  B --> C{"All existing paths owned?"}
  C -->|Yes| F["Return Env"]
  C -->|No| D["Load protected settings with GitDir cleared"]
  D --> E{"safe.directory allows the path?"}
  E -->|Yes| F
  E -->|No| G["Return ErrUntrusted"]
Loading

Reviews (3) · Last reviewed commit: "improve/simplify trusted dir handling" · Reviewed by Greptile

Comment thread discover.go Outdated
Comment thread discover.go Outdated
Comment thread env_test.go
Comment thread go.mod
Comment thread platform_windows.go
Comment thread platform_windows.go
@MichaelMure
MichaelMure merged commit 77c5869 into master Oct 9, 2026
4 checks passed
@MichaelMure
MichaelMure deleted the trusted-dit branch October 10, 2026 15:33
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