Repository navigation
Compare the blob policy verification level as a string - #593
Conversation
Co-Authored-By: Claude <noreply@anthropic.com> Signed-off-by: Arpit Jain <arpitjain099@gmail.com>
cshung
left a comment
There was a problem hiding this comment.
Code LGTM. This restores the existing intent to reject global skip; the previous comparison was broken. The updated code is now specification compliant in this regard and more secure by default.
One consideration is compatibility. If, in the worst case, an existing deployment depends on global skip, a possible short-term migration is to convert it to a non-global named skip policy and update the surrounding caller to select it explicitly. Where that caller is centrally controlled, this can preserve default-off behavior without requiring every end user to opt out.
Ideally, no deployments need that workaround, and things should be secure by default. Maintainers should explicitly accept the compatibility risk and communicate this migration option where applicable.
yizha1
left a comment
There was a problem hiding this comment.
LGTM per the Notary Project specification:
For a given OCI artifact, if there is no applicable trust policy then implementations of the Notary Project verification specification MUST consider the artifact as untrusted and fail signature verification.
|
@arpitjain099 Could you please update the branch so we can proceed? |
|
@yizha1 done, I have updated the branch with main. Please let me know if anything else is needed, and thanks for the review. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #593 +/- ##
==========================================
+ Coverage 82.80% 82.88% +0.07%
==========================================
Files 36 36
Lines 2635 2635
==========================================
+ Hits 2182 2184 +2
+ Misses 311 310 -1
+ Partials 142 141 -1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
BlobDocument.Validatemeans to forbid a global blob policy from skipping verification, but the comparison cannot fire.SignatureVerification.VerificationLevelis astringholding the level name, whileLevelSkipis a*VerificationLevel, soreflect.DeepEqualis handed two different types and is always false.The sibling in
verifier.go:253runs the same idiom correctly, because thereverificationLevelreally is a*VerificationLevelreturned byGetVerificationLevel. Only the blob document path compares the raw string.There is no second gate behind it.
validatePolicyCorerejectsskipwhen trust stores or trusted identities are set, but permits it when they are absent, which is the shape that reaches this check. So a blob policy document withglobalPolicy: trueandlevel: skipvalidates cleanly today and ends up with every enforcement field set to skip.Comparing against
LevelSkip.Nameis what the field holds, andreflectwas imported only for this line so it goes too.The new case fails on main with
got <nil>fromValidate, and passes here. I added the non-global case beside it, since a statement that is not the global policy is still allowed to use skip and should stay that way. The repo is green, zero failures across all packages.