Skip to content

Conversation

@baszalmstra
Copy link
Contributor

This PR implements the feature requested in issue #1895, adding an optional expected-commit field to git source configurations.

Changes:

  • Added expected_commit field to GitSource struct in source.rs
  • Added GitCommitMismatch error variant to SourceError enum for structured error handling with expected, actual, and rev fields
  • Implemented verification logic in git_source.rs to compare actual commit against expected commit after checkout
  • Added comprehensive unit tests for serialization/deserialization
  • Added integration tests for both success and failure cases
  • Created test recipe demonstrating the feature
  • Updated documentation in recipe_file.md with usage examples

The feature helps ensure security and reproducibility by detecting when a git tag or branch has been moved to point to a different commit than expected.

Closes #1895

@baszalmstra baszalmstra requested a review from wolfv November 6, 2025 16:09
This commit implements the feature requested in issue prefix-dev#1895, adding
an optional `expected-commit` field to git source configurations.

Changes:
- Added `expected_commit` field to GitSource struct in source.rs
- Added GitCommitMismatch error variant to SourceError enum for
  structured error handling with expected, actual, and rev fields
- Implemented verification logic in git_source.rs to compare actual
  commit against expected commit after checkout
- Added comprehensive unit tests for serialization/deserialization
- Added integration tests for both success and failure cases
- Created test recipe demonstrating the feature
- Updated documentation in recipe_file.md with usage examples

The feature helps ensure security and reproducibility by detecting
when a git tag or branch has been moved to point to a different
commit than expected. Inspired by Wolfi/Melange.

Closes prefix-dev#1895
@baszalmstra baszalmstra force-pushed the claude/issue-1895-fix-011CUrtSiPRXV2b8hgN64eFN branch from 6d5ef7d to 2e4484b Compare November 6, 2025 16:17
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.

Add expected-commit verification to git sources

2 participants