Skip to content

feat(tvc): add pivot digest validation#118

Open
annieke wants to merge 2 commits into
mainfrom
annie/add-pivot-digest-validation
Open

feat(tvc): add pivot digest validation#118
annieke wants to merge 2 commits into
mainfrom
annie/add-pivot-digest-validation

Conversation

@annieke
Copy link
Copy Markdown
Contributor

@annieke annieke commented Apr 8, 2026

A TVC app will fail to deploy if the pivot digest does not match what's pulled from the container URL. We expect users to computer their own digest via docker create and sha256sum, and also expose it in the helloworld template - this PR adds the final piece to locally validate the pivot hash.

Usage

Pivot hash validation can be individually invoked via tvc deploy validate-pivot-digest, but also through --validate-pivot-digest during deploy create and deploy approve.

There is some overlap with #117. Given that image validation is lighter (just one API call) compared to this PR, my plan is to default to image validation during deploy create, and run this only when the flag is provided (but skip image validation since the functionality here is a superset of that one).

Implementation

To avoid requiring docker, i added oci-client to pull the image, flate2 and tar to read layers. Down to talk about reworking this change if these crates are too bloat-y.

@annieke annieke requested a review from a team as a code owner April 8, 2026 19:36
@socket-security
Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedreqwest@​0.13.27910093100100
Addedflate2@​1.1.910010093100100
Addedtar@​0.4.4510010093100100
Updatedattestation-doc-validation@​0.8.0 ⏵ 0.9.010010093100100
Updatedsignature@​2.0.0 ⏵ 2.2.010010093100100
Addedoci-client@​0.16.19910097100100

View full report


/// Path to an unencrypted Docker-style pull secret JSON file.
#[arg(long, value_name = "PATH")]
pub pull_secret: Option<PathBuf>,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Do people normally store the pull secret as a file? either way i think they could also do --pull-secret <(echo "contents")

)
.await?;
validate_expected_digest(&result.digest, &hex::encode(manifest.pivot.hash))?;
print_result(&result);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: i would prefer using path so it reads validate_pivot_digest::print_result bc otherwise print_result sounds vague

@emostov
Copy link
Copy Markdown
Contributor

emostov commented Apr 9, 2026

To avoid requiring docker, i added oci-client to pull the image, flate2 and tar to read layers. Down to talk about reworking this change if these crates are too bloat-y.

This could be a bit rough because we likely need to review all the source code for these. I can double check with our code review tooling since a small chance its already included in trusted repos

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.

2 participants